You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
java server refreshing the workspace (cleaning and building) for each restart which is taking a lot of time #2222
[vscode java server refreshing the workspace (cleaning and building) for each restart which is taking a lot of time]
Environment
Operating System: Windows 10
JDK version: JDK 11
Visual Studio Code version: 1.61.2
Java extension version: v0.18.6
Java Debugger extension version: v0.36.0
Steps To Reproduce
Please refer the jira. As per the direction , creating the issue in vscode-java
I have a workspace with 5 maven projects which is already refreshed by the vscode java server. But if I simply restart the workspace, its again repeating the workspace refreshment with cleaning and building which is taking a lot of CPU and time. Why its redoing the same thing again and again
[attach a sample project reproducing the error] attach logs
Current Result
The workspace restart is consuming a lot of CPU and time for the vscode java server for doing the workspace refresh
Expected Result
The worspace should refresh and restart very quickly
Is the code base available anywhere to try to reproduce this ? @fbricon are there any enhancement requests you're aware of on JDT-LS or m2e to allow a Maven import to happen without also doing a project rebuild ?
I'm not sure if your fix improves anything for me. If I import lemminx (as an example), it takes about 30s with or without your vsix. In fact, I can see that new classfiles are still generated on import, and the build seems to happen as well.
I guess the problem is a user/process could easily modify the sources between the language server shutting off and starting back up, so it makes sense to rebuild. Disabling java.autobuild.enabled can probably speed things up, but then one has to re-enable it immediately after to ensure subsequent edits are caught.
FWIW, I tried with spring-petclinic initially and noticed there was some improvement in the time it takes to finish the build (and get to ServiceReady). I just didn't see it when I tried lemminx so figured maybe it was some other cause. I'll try again more thoroughly.
With java.autobuild.enabled:false, with/without this change, a workspace build takes about ~15s when the LS workspace is cleaned and ~5s if just re-opening the workspace. When I time the clean workspace job, it seems to take ~2s so there definitely is some improvement by not having it run all the time.
With java.autobuild.enabled:true, it's about ~25s from a clean workspace, and ~17s. It seems to be about the same for a regular build and your change. Given that the workspace clean happens in a separate thread, I wouldn't be surprised if it cannot really be measured, though maybe it just reduces pressure on the CPU for more intensive projects. Are you seeing the same thing ?
I've tried again with lemminx, since maybe spring-petclinic builds too quickly on my machine. It went from ~17s normally, to ~3s with this change. That's definitely a big deal . Yes, I can confirm the "Clean workspace..." doesn't run any longer.
Activity
rgrunber commentedon Nov 19, 2021
Is the code base available anywhere to try to reproduce this ? @fbricon are there any enhancement requests you're aware of on JDT-LS or m2e to allow a Maven import to happen without also doing a project rebuild ?
snjeza commentedon Nov 20, 2021
@bitsInnovate00 @rgrunber Could you, please, check https://github.com/snjeza/vscode-test/raw/master/java-1.1.0.vsix ?
rgrunber commentedon Nov 22, 2021
I'm not sure if your fix improves anything for me. If I import lemminx (as an example), it takes about 30s with or without your vsix. In fact, I can see that new classfiles are still generated on import, and the build seems to happen as well.
I guess the problem is a user/process could easily modify the sources between the language server shutting off and starting back up, so it makes sense to rebuild. Disabling
java.autobuild.enabledcan probably speed things up, but then one has to re-enable it immediately after to ensure subsequent edits are caught.snjeza commentedon Nov 23, 2021
@rgrunber Could you, please, try spring-petclinic?
mozhuanzuojing commentedon Nov 23, 2021
@snjeza I just used your
1.1.0for testing and it has fixed the problem. thank you very much.mozhuanzuojing commentedon Nov 23, 2021
@snjeza . version
1.0.0reproduced this same problem with another #2071, but your1.1.0fix it.rgrunber commentedon Nov 23, 2021
FWIW, I tried with spring-petclinic initially and noticed there was some improvement in the time it takes to finish the build (and get to
ServiceReady). I just didn't see it when I tried lemminx so figured maybe it was some other cause. I'll try again more thoroughly.snjeza commentedon Nov 23, 2021
@rgrunber could you, please, check https://github.com/snjeza/vscode-test/raw/master/java-1.1.1.vsix with enabled and disabled the
java.autobuild.enabledproperty?rgrunber commentedon Nov 23, 2021
With
java.autobuild.enabled:false, with/without this change, a workspace build takes about ~15s when the LS workspace is cleaned and ~5s if just re-opening the workspace. When I time the clean workspace job, it seems to take ~2s so there definitely is some improvement by not having it run all the time.snjeza commentedon Nov 23, 2021
@rgrunber Could you, please, test with
java.autobuild.enabled:true?rgrunber commentedon Nov 24, 2021
With
java.autobuild.enabled:true, it's about ~25s from a clean workspace, and ~17s. It seems to be about the same for a regular build and your change. Given that the workspace clean happens in a separate thread, I wouldn't be surprised if it cannot really be measured, though maybe it just reduces pressure on the CPU for more intensive projects. Are you seeing the same thing ?snjeza commentedon Nov 24, 2021
@rgrunber When restarting a workspace, Java LS with the PR doesn't run the clean workspace action. See eclipse-jdtls/eclipse.jdt.ls@999001c#diff-f23d0258ce24117c110acd6753e8490a09fbdf0bc039d662bdffe279c8c28469R320

Java Build Status without the PR (for each restart):
Java Build Status with the PR (for each restart):

rgrunber commentedon Nov 24, 2021
I've tried again with lemminx, since maybe spring-petclinic builds too quickly on my machine. It went from ~17s normally, to ~3s with this change. That's definitely a big deal . Yes, I can confirm the "Clean workspace..." doesn't run any longer.