-
Notifications
You must be signed in to change notification settings - Fork 327
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
Stream read errors result in uncaught exceptions #270
Comments
Yes, but we should clearly defined that the readere then moves into an error state and doesn't process any new onData events since it can not meaningful recover from a missing content length. |
Any workaround? It is really really bad if your server crashes just because some LSP stream got broken. Depending on context, could be a security vulnerability. |
The got improved already an errors are now reported on the connection. What esle do you expect the reader to do if it receives a broken message |
When an error occurs, the entire Node.js process is crashed for me. Do I have to register an error handler to prevent this from happening, or am I doing something else wrong that is causing me to mistakenly blame this package? |
Not sure I understand that correctly. The server node process crashes ? |
Yes. The Node.js process that is running vscode-languageserver-node crashes (after printing stack trace from vscode-languageserver-node). |
What seems strange to me is that the node process crashes. It shouldn't :-) But I am open for a PR that converts the exception into a fireError. |
In particular this is what is printed before the server crashes.
|
I just tested, and uncaught exceptions do (in general) crash Node. I believe this is intended behavior. Test:
|
OK. Now I understand. Under crash I was assuming a real process crash. For the servers I maintain I have a |
This got addressed in the meantime. The exception are now reported via the |
Currently, message errors from StreamMessageReader's onData method end up as uncaught exceptions, which can be very difficult to handle when used in server contexts.
https://github.com/Microsoft/vscode-languageserver-node/blob/master/jsonrpc/src/messageReader.ts#L220
Would it be reasonable to convert such errors into error events (via
this.fireError
) so that the stream owner can perform shutdown / restart steps as necessary? I can submit a PR to do so. cc @ljw1004The text was updated successfully, but these errors were encountered: