eclipse.jdt.ls
eclipse.jdt.ls copied to clipboard
VSCode JLS error when loading project with lot of Maven sub modules
Fixes https://github.com/redhat-developer/vscode-java/issues/3637
Steps to reproduce:
- exit VS Code
- Clean the workspace directory
- clone the repository quarkus-langchain4j
- cd quarkus-langchain4j
- code .
- wait for the build to finish
- reload the VS Code window (it freezes without the PR; takes several seconds with the PR or VS Code 1.32.0)
@snjeza could you pls explain the root cause of this issue?
could you pls explain the root cause of this issue?
There are several issues:
- ProjectManager.registerWatchers() is called too early -https://github.com/eclipse-jdtls/eclipse.jdt.ls/pull/3150/commits/cfb076c10a86523d734942f29364d0d90aa6634f#diff-f82616576dc1fa363177feaadbbde3568ec33ec20588a8e7656ba45ded34bc52R330
- StandardProjectsManager.configureSettings(Preferences, boolean) is always called from InitHandler.triggerInitialization(Collection<IPath>) line 292 - IProjectsManager.registerListeners()
- JavaCore.setOptions() is called even when the options have not been changed. It causes rebuild - https://github.com/eclipse-jdtls/eclipse.jdt.ls/pull/3150/commits/cfb076c10a86523d734942f29364d0d90aa6634f#diff-f23d0258ce24117c110acd6753e8490a09fbdf0bc039d662bdffe279c8c28469R362
- Java LS updates maven projects always if the root maven project has the .mvn directory - https://github.com/eclipse-jdtls/eclipse.jdt.ls/pull/3150/commits/cfb076c10a86523d734942f29364d0d90aa6634f#diff-4b8c66d1045232aafc8ad5fc1c52decc87f1e67eb86815b224de947215ba48d2R197
test this please
From testing this out, I don't see a major improvement in terms of build time or memory :
On quarkus-langchain4j project :
Prior to this change, initialization & "service ready" took about 75s and build time took around 190s. With this change, it's about the same (based on report from telemetry/event).
Without PR
With PR
We can still look at the changes here on their own based on whether they are an improvement (logically) but it's probably best if the commenters on MacOS can verify whether the change does anything for them in the issue.
@rgrunber Could you try to restart the server after it has been successfully built? When restarting, the server freezes without the patch. With the patch, it takes several seconds. I suppose @philippart-s and @maxandersen have faced the issue when restarting the server,
@rgrunber You can try to restart the keycloak with and without the PR too - https://github.com/redhat-developer/vscode-java/issues/3639
@rgrunber I have updated the steps to reproduce. See steps 6 and 7 - https://github.com/eclipse-jdtls/eclipse.jdt.ls/pull/3150#issue-2279821730 Step 6 works with and without the PR. The issue happens in step 7. It can't be reproduced in Eclipse.
@rgrunber The workspace is always rebuilt when "java.jdt.ls.lombokSupport.enabled": true.
Try to set "java.jdt.ls.lombokSupport.enabled": false and restart the workspace.
Note: quarkus-langchain4j and keycloak have been built properly. my settings.json:
{
"java.import.generatesMetadataFilesAtProjectRoot": true,
"java.compile.nullAnalysis.mode": "disabled",
"java.gradle.buildServer.enabled": "off",
"java.server.launchMode": "Standard",
"java.jdt.ls.vmargs": "-Dlog.level=ALL -Djdt.ls.debug=true -XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx6G -Xms512m -Xlog:disable",
"java.import.exclusions": [
"**/node_modules/**",
"**/node/**",
"**/js/**",
"**/distribution/**",
"**/themes/**",
"**/testsuite/**",
],
"java.trace.server": "messages",
"java.jdt.ls.lombokSupport.enabled": false,
I'm pretty confident this will improve things. In particular (prior to this PR), If I attempted to reload the workspace, I would see :
Basically a bunch of jobs to update individual projects. With your PR, this no longer happens and the language server never gets stuck or runs out of memory.
I did notice there's some extra build jobs in the case of lombok support being enabled but at least the builds were not getting stuck. I think all that's left for me is to go through each of the changes.
Was the use of of Lombok the trigger or how?
Was the use of of Lombok the trigger or how?
@maxandersen There are several issues. Please see https://github.com/eclipse-jdtls/eclipse.jdt.ls/pull/3150#issuecomment-2096688871
Basically a bunch of jobs to update individual projects. With your PR, this no longer happens and the language server never gets stuck or runs out of memory.
@rgrunber Please see https://github.com/eclipse-jdtls/eclipse.jdt.ls/pull/3150#issuecomment-2096688871 issue 4
@rgrunber I have updated the PR.
test this please
Only other change I would make is to the commit message. Rename this to something like :
@rgrubner I have done it.