Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[lsp4e-dev] debugging multi-threaded access

Hey!

I am trying to debug a case where multiple instances of the same language server get started and being used simultaneously by LSP4E.
I don’t know exactly how this happens (hard to reproduce), but while debugging the code, I am quite concerned about the threading and the LSP4E behavior around that.

Here are my observations (for “LanguageServerWrapper”):
- “allWatchedProjects” can be accessed by multiple threads executing “watchProject” in parallel
- same can happen for “unwatchProject”

I think both methods should be synchronized (at least).

“canOperate” is the same, but even more dangerous, I think. It accesses “supportWorkspaceFoldersCapability”, which is set lazily and asynchronously when the initializeRequest is coming back from the language server. However, “canOperate” can be called for the wrapper before this request comes back, resulting is probably false negatives here.

Any thoughts/additional insights here? Maybe I am missing something…
Any help would be appreciated.

Cheers,
-Martin




Back to the top