-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle socket errors #51
Comments
The best way to start is to listen socket 'error' events. |
I don't know enough of the node socket API to guess what caused the error. Listening to the error event sounds great - what should the library do on error? Republishing it to the API is a start, but I imagine the library also needs to clean up state in case there's an error. Do you know who the right people are to ask about this? We just started using this code and I don't know who the active maintainers are. Thanks for responding! Cheers, -- while mobile On Nov 17, 2011, at 3:08 PM, Andrey [email protected] wrote:
|
I'm maintainer and main developer What are the main use cases for library? I'm currently preparing big changes in API and hope to see as much feedback as possible. Please share your proposals on the ML if you think it would be useful for others. Other than finishing 'mlc' branch development planned features are speed and more tests. Code is on branch 'mlc' API examples var db = mysql.createClient(params); // this will result in simple query // this will result in prepare + execute //next two queries are executed in parallel id there are two available connections |
Awesome - I love how responsive you are being! Very much appreciated. We're using the library for an internal stats dashboard at Clover. I intend to open source it. The minimum in the current API I believe is emitting an error event on the command/connection object and cleaning up any state associated with that command. Caller can then choose to re-issue the command, show an error, etc. The error just needs to be exposed through the API, rather than thrown. What I like about your current API is that you're emitting a stream of row events, rather than a single JSON object. Keep it that way. Felixge's branch is already fine if you want the response in one chunk. -- while mobile On Nov 18, 2011, at 12:01 AM, Andrey [email protected] wrote:
|
I currently have this fugly hack in prod :)
|
I hope to push connection errors & restart handling soon. You can check before query if (mysqlClient.connection.writable) - this should fail if connection had not been not opened in constructor or closed since last command |
It seems like all socket errors are not being handled.
This example calling code:
ended up with this stack trace:
My best guess is that we should be checking in
command.js
At least the 'error' event should bubble up all the way to the client API, rather than crashing the process.
The text was updated successfully, but these errors were encountered: