Closed tsaarni closed 2 months ago
I'm able to reproduce this as well, though I needed -Xmx4G
instead of 1G for java.jdt.ls.vmargs
to fully import.
The thing that immediately stood out, and which I saw in my logs as well is :
{
message: "[Trace - 10:30:08] Sending notification 'workspace/didChangeWatchedFiles'.",
level: 'info',
timestamp: '2024-05-03 10:30:08.190'
}
{
message: 'Params: {\n' +
' "changes": [\n' +
' {\n' +
' "uri": "file:///home/rgrunber/sample-projects/keycloak/distribution/licenses-common/target/classes/keycloak-licenses-common/LICENSE.txt",\n' +
' "type": 2\n' +
' }\n' +
' ]\n' +
'}\n' +
'\n',
level: 'info',
timestamp: '2024-05-03 10:30:08.190'
}
Other than progress & diagnostic notifications, I didn't see anything else in the build process that might be responsible for triggering a rebuild.
I think https://github.com/eclipse-jdtls/eclipse.jdt.ls/blob/d6bc183c77428d586b58fe8a5afcd8bd4bc98f20/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/JDTUtils.java#L1266 ( https://github.com/eclipse-jdtls/eclipse.jdt.ls/pull/1207 ) might be responsible since I can stop the cycle just by setting the parent to null
.
The pom is https://github.com/keycloak/keycloak/blob/main/distribution/licenses-common/pom.xml and the configuration is handled by build-helper-maven-plugin.
@snjeza , any idea why this happens or how we could deal with it ?
~~The issue is caused by the maven-antrun-plugin plugin. It creates a java project and restarts the build. A workaround~~
"java.configuration.maven.defaultMojoExecutionAction": "ignore",`
You can also try VS Code 1.32.0. See https://github.com/eclipse-jdtls/eclipse.jdt.ls/pull/3150
Thanks @snjeza and @rgrunber!
I tried both:
java.configuration.maven.defaultMojoExecutionAction
to ignore
(though the readme says ignore
is the default?) but for some reason, these did not help for me. I still end up in build that never finishes.
As @rgrunber pointed out license file generation, I now tested removing following lines from Keycloak https://github.com/keycloak/keycloak/blob/6a38be6239ad9dad7fb0c4941c117eddadc7958b/distribution/licenses-common/pom.xml#L30-L44. That allowed me to open and build the project again, so it is true that it is the culprit.
I tried https://github.com/eclipse-jdtls/eclipse.jdt.ls/pull/3150 as well and it didn't stop the build loop. I tried with a clear workspace cache for the keycloak project. The default is definitely ignore
for java.configuration.maven.defaultMojoExecutionAction
so it had no effect.
It could just be that the issues fixed there have no effect here.
Update: Ok, I saw one instance where the build loop stopped after maybe about 6 consecutive build operations. I think I'd have to run this some more times before/after the change to see if it actually improves it or if there's some chance the build loop doesn't occur.
@rgrunber You are right. The keycloak project has other issues. However, https://github.com/eclipse-jdtls/eclipse.jdt.ls/pull/3150 should help. Did you try the following:
$ cd keycloak
$ code .
wait for the build to finish
reload the VS Code window (this step should be much faster with #3150)
The build should also be faster because we postponed workspace/didChangeWatchedFiles
after finishing the build. See https://github.com/eclipse-jdtls/eclipse.jdt.ls/pull/3150/commits/cfb076c10a86523d734942f29364d0d90aa6634f#diff-a5ac9de1e29f9f41ff8198d1422328687328e9daacea58594ecd68b4ecde2311R61
... or if there's some chance the build loop doesn't occur.
I will check.
I tried this out with the latest pre-release and am still seeing the build loop for keycloak. @snjeza let me know if you see this as well. Is there anything we can do ?
Here's what I noticed (note the timestamps) :
[Trace - 15:24:49] Received notification 'textDocument/publishDiagnostics'.
Params: {
"uri": "file:///home/rgrunber/sample-projects/keycloak/saml-core/src/test/java/org/keycloak/saml/common/util/StaxParserUtilTest.java",
"diagnostics": [
{
"range": {
"start": {
"line": 51,
"character": 67
},
"end": {
"line": 51,
"character": 73
}
},
"severity": 2,
"code": "67108967",
"source": "Java",
"message": "The method none() from the type ExpectedException is deprecated",
"tags": [
2
]
}
]
}
[Trace - 15:27:19] Received request 'window/workDoneProgress/create - (29)'.
Params: {
"token": "17a78d3e-ac88-4893-8b16-7768fc282144"
}
[Trace - 15:27:19] Sending response 'window/workDoneProgress/create - (29)'. Processing request took 0ms
No result returned.
[Trace - 15:27:19] Received notification '$/progress'.
Params: {
"token": "17a78d3e-ac88-4893-8b16-7768fc282144",
"value": {
"kind": "begin",
"title": "Building",
"message": "Building"
}
}
The language server completed the build, sent the diagnostics, and was quiet for a few minutes. I didn't perform any actions, and could hear that my fans had spun down after the initial build. Then, the build job started for no reason I could see.
let me know if you see this as well. Is there anything we can do ?
@rgrunber I'm checking
I tried this out with the latest pre-release and am still seeing the build loop for keycloak. @snjeza let me know if you see this as well. Is there anything we can do ?
I can't can reproduce the issue.
Steps to reproduce:
$ cd <keyloack>
$ ./mvnw clean
$ rm -rf ~/.config/Code/User/workspaceStorage/
$ rm -rf `find . -name .project `; rm -rf `find . -name .classpath `; rm -rf `find . -name .settings`
$ git clean -fd
$ code .
@rgrunber could you try to add the following property to settings.json
"java.import.exclusions": [
"**/node_modules/**",
"**/.metadata/**",
"**/archetype-resources/**",
"**/META-INF/maven/**",
"**/keycloak/**",
"**/keycloak",
"!**/keycloak/core",
"!**/keycloak/common",
"!**/keycloak/boms",
"!**/keycloak/boms/**",
"!**/keycloak/adapters",
"!**/keycloak/adapters/**",
"!**/keycloak/authz",
"!**/keycloak/authz/**",
"!**/keycloak/crypto",
"!**/keycloak/crypto/**",
"!**/keycloak/dependencies",
"!**/keycloak/dependencies/**",
"!**/keycloak/examples",
"!**/keycloak/examples/**",
"!**/keycloak/federation",
"!**/keycloak/federation/**",
"!**/keycloak/integration",
"!**/keycloak/integration/**",
"!**/keycloak/model",
"!**/keycloak/model/**",
"!**/keycloak/operator",
"!**/keycloak/operator/**",
// ... You can add any keycloak subfolder other than distribution, js, node , node_modules.
],
I tried this out with the latest pre-release and am still seeing the build loop for keycloak.
~~The null analysis can cause the build loop.
One workaround is to set "java.compile.nullAnalysis.mode": "disabled"
~~
I'm preparing a fix.
The issue is an upstream m2e issue. It happens when m2e can't configure the project's classpath. m2e configures the Java Nature and Builder but doesn't configure the classpath.
You can try to import test3639.zip You will notice that the project contains .project with the Java nature and builder but doesn't contain .classpath.
keycloak includes one similar project as described at https://github.com/redhat-developer/vscode-java/issues/3639#issuecomment-2093437052
v1.33.2024072008
from the pre-releases should contain the fix.
Background:
I'm working on Keycloak using vscode-java. This project has proven to be quite challenging before, and unfortunately I now again have new problems that I'd kindly ask for help to troubleshoot.
The problem:
When opening the project the Java build never finishes. The constant re-compilation on the background will consume considerable CPU resources and heat up the machine.
The project builds correctly from command line using
mvn
.Environment
Steps To Reproduce
Current Result
The loop that gets executed again and again consists of following sequence of maven modules (grepping from logs):
it will then start from the
keycloak-parent
again, and continue forever, trying to build this set of modules. I'm not able to identify the reason why the build is (re)triggered again and again.Here are some log files from build:
Expected Result
Build should finish.
Additional Informations
I'm enabled following logs in
.vscode/settings.json
I've also tried excluding submodules by adding following in
.vscode/settings.json
but build still gets stuck in the same way, even though in theory the looping modules should not even be imported anymoreSome time ago I could open the project without infinite build loop. I did not use exclusions or any other workarounds in settings. At the moment, I do not yet know if my problem appeared after changes in Keycloak code or possibly after vscode-java update, or something else.