-
Notifications
You must be signed in to change notification settings - Fork 334
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
Client: duplicate messages sent after server restart #342
Comments
I tired to reproduce this using the ESLint extension but failed. Which version of the client library are you using? |
I know there were issues when restarting the server (see issues here). |
4.0.0 There is a PR to upgrade us to 4.1.0, so I'll investigate with that too. |
I can still repro with 4.1.0 Is there any logging I can provide which would be useful? |
You can try to debug this. The code that is invoked on connection close and does the restart is here: And the cleanup of the listeners happens here: Do these methods get executed when you kill the server? |
This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines. Happy Coding! |
@nrc any information ? |
@dbaeumer Hi, sorry I haven't had a chance to try and debug yet. Hopefully I'll give it a go tomorrow. |
@dbaeumer Hi, sorry it is a bit later than expected, but I had a look and I have (I think) diagnosed what is going on. The When the client is Because the features are not reset as part of the start/stop lifecycle, the Now, when a change happens, the I believe the fix is to move the call to |
@nrc thanks a lot for the very good analysis. Very good catch. I didn't see this with ESLint since it uses a full text sync and these are debounced on the client side hence they are only send once. The fix is quite simple. Each feature has a dispose method which is called when the server goes down. The |
@nrc I published a new client and server. Please let me know if using these fixes the problem. |
I updated and checked and it seems to be working fine now. Thanks for the fix! |
@nrc and thanks again for the analysis. |
STR: start an extension with a language server (I use the Rust Language Server but I believe any extension/language server would do). Kill the language server process. The client restarts the server (as it should), but now every message (notification or request) is duplicated. If you kill the server again, you get three of each message, and so forth.
From looking at the source code for the client, it looks to me that when the client restarts the server it should properly cleanup the
connection
, but does not (so handlers are not removed). The connection is re-initialized, but by callingonRequest
,onNotification
, etc. the client is installing extra copies of the handlers into the connection, not replacing the previous handlers. So, when a message is sent to the connection it is dispatched multiple times to the server.cc microsoft/vscode#48309
The text was updated successfully, but these errors were encountered: