-
Notifications
You must be signed in to change notification settings - Fork 273
Description
- Did you upgrade to latest plugin version? yes
- Did you upgrade to/compile latest binary?
languageclient 0.1.147
Describe the bug
Multiple php language servers are started up on vim startup when vim opens multiple php files with vim -p. This requires a lot of memory to initialize (causes swapping if there are dozens of files), and all but one don't end up being used
I believe this is a race condition in src/language_server_protocol.rs in languageClient_startServer.
The project that I'm editing with vim is very large, so the language server takes more than a second to respond to the language server initialize RPC request
if self.get(|state| state.clients.contains_key(&Some(languageId.clone())))? {
return Ok(json!({}));
}
// much, much later, without a mutex getting acquired globally or for the language id
self.update(|state| {
state.clients.insert(Some(languageId.clone()), client);
Ok(())
})?;Environment
- vim 8.1-1-1778
- This plugin version (
git rev-parse --short HEAD): c851073 - This plugin's binary version (
bin/languageclient --version): 0.1.147 - Minimal vimrc content: TODO
- Language server link and version: https://github.com/TysonAndre/LanguageServer-phan-neovim (latest)
To Reproduce
Steps to reproduce the behavior:
- Set up phan for a large project and install the language server
- Start vim,
vim -p file1.php file2.php file3.php file4.php ps -ef|grep -i php. Observe that initially, multiple language servers are running, but afterwards, there are defunct php processes with thebin/languageclientas the parent process.
Current behavior
Multiple php language servers are started up on vim startup when vim opens multiple php files with vim -p. This requires a lot of memory to initialize (causes swapping if there are dozens of files), and all but one don't end up being used
Expected behavior
A single php language server is started up (i.e. one per language, or one per server command in the future)
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.