eclipse-jdtls / eclipse.jdt.ls

Java language server
1.76k stars 393 forks source link

Server shutdown too slow when it open large maven project #758

Closed Flanker32 closed 6 years ago

Flanker32 commented 6 years ago

Java Language Server will do some job when close the sever and it may takes more than half a minute when the project is large enough. However, VSCode will kill plugin in 5 seconds when it called shutdown function, which makes no time to save the worksapce infos, and language server will do maven reimport when it open an imported project.

Flanker32 commented 6 years ago

https://github.com/Microsoft/vscode/issues/35196 C++ plugins also have the same problem before.

snjeza commented 6 years ago

I haven't succeeded to reproduce the issue on my machine. I have tested https://github.com/eclipse/che. m2e creates the workspaceState.ser file with 3.7MB in size. MavenPluginActivator.stop() that calls writeWorkspaceState() takes less than a second.

@Flanker32 What project and OS are you using?

Java Language Server will do some job when close the sever and it may takes more than half a minute when the project is large enough.

760

RegistryManager.writeWorkspaceState will be called about half a minute later (in my computer) after the shutdown() fucntion was called

How much RAM does your computer have?

Flanker32 commented 6 years ago

I use springboot as the test project. I do the experiment in Windows 10 1803 with 16G ram, and the xmx of jvm was set to 2G. @snjeza

snjeza commented 6 years ago

I still can't reproduce the issue. @Flanker32 I think you close VS Code before spring-boot has been built. Try the following using the Git command line:

You can see workspaceState.ser has been created correctly.

Flanker32 commented 6 years ago

@snjeza Please remove springboot-gradle-plugin from the project for language server may meet some problems when open a maven project with gradle sub project. (Delete the folder spring-boot-project\spring-boot-tools\spring-boot-gradle-plugin and remove gradle tool item in pom file of spring-boot-tools) I redo the experiment with JDK 8 and the workspaceState.ser wasn't created when i close vscode, besides it takes me long time(about 5 minutes) to open springboot folder with vscode.

snjeza commented 6 years ago

The issue can be reproduced on Windows. https://github.com/eclipse/eclipse.jdt.ls/pull/760 fixes it.

@fbricon We could call writeWorkspaceState in a save participant instead of in MavenPluginActivator.stop().

snjeza commented 6 years ago

Related m2e bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=538609

snjeza commented 6 years ago

Fixed within https://bugs.eclipse.org/bugs/show_bug.cgi?id=538609