Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension keeps building code, never finishing #1341

Closed
fo-fo opened this issue Mar 25, 2020 · 22 comments
Closed

Extension keeps building code, never finishing #1341

fo-fo opened this issue Mar 25, 2020 · 22 comments

Comments

@fo-fo
Copy link

fo-fo commented Mar 25, 2020

I'm trying to use the vscode-java extension in VSCode, but it keeps on building the same source code (it seems) again and again, hogging 100% CPU.

I see lines like this in the Task - Java Build Status Terminal: 1e7bf092 Building: 72% Compiling foo/src/test/java/fi/bar/xyzzy/controller [720/1000]. After it completes, it starts again.

I set the "Trace" setting in Settings to "messages", and saw this in the logs multiple times: [Trace - 9:47:08 AM] Sending notification 'workspace/didChangeWatchedFiles'., followed by a bunch of [Trace - 9:47:08 AM] Received notification 'language/progressReport'.

My guess is that it somehow thinks that some of the watched files have changed. How can I find out which files are causing the build to re-trigger?

Environment
  • Operating System: macOS Catalina 10.15.3
  • JDK version: jdk1.8.0_161
  • Visual Studio Code version: 1.43.2
  • Java extension version: 0.58.0
Steps To Reproduce

Unfortunately it only happens in our fairly large proprietary project.

Current Result

Keeps rebuilding the code forever.

Expected Result

Should stop building after a reasonable time.

Additional Informations
@testforstephen
Copy link
Collaborator

@fo-fo if you change the java trace setting to "verbose", you will see the full logs about "workspace/didChangeWatchedFiles" notification.

@fo-fo
Copy link
Author

fo-fo commented Mar 30, 2020

@testforstephen Thanks, I was able to narrow down the cause. It seems that RAML code generation is the culprit, as didChangeWatchedFiles refers to the generated files and I can see the generated files' time stamps changing every few minutes. So, it seems like the build changes the files, which then triggers didChangeWatchedFiles and a rebuild, which again changes the files, and so on.

I'm not sure how to fix it though. We're using springmvc-raml-plugin Maven plugin and a custom Ant buildfile for preprocessing the RAML sources, as well as an Ant Replace task for post processing the generated files. (By the way, the issue doesn't happen in IntelliJ IDEA.)

Any ideas where I should start looking?

@testforstephen
Copy link
Collaborator

The built-in builder won't support ant, and it's an incremental builder, which is supposed to not regenerate the files. Do you have other building jobs running in the background?

@fo-fo
Copy link
Author

fo-fo commented Apr 8, 2020

@testforstephen Nope, no other build jobs running. And as soon as I turn off auto build I can see from the RAML file timestamps that the files are no longer being regenerated. Moreover, if I disable springmvc-raml-plugin in Maven's pom.xml the issue disappears. If I disable the Ant jobs but leave springmvc-raml-plugin enabled, the issue persists, so it seems like the Ant jobs are not the cause.

We also have swagger-codegen-maven-plugin and openapi-generator-maven-plugin, they work without a problem, so it must be something specific to how springmvc-raml-plugin works.

@testforstephen
Copy link
Collaborator

OK. By default, Intellij IDEA doesn't compile classes automatically, that's probably the reason why you didn't get the issue there.

@ianldgs
Copy link

ianldgs commented May 27, 2021

This causes problems if you try to run maven commands.
Some files will be locked or modified by the autobuild process and then maven will fail.
Ideally, the autobuild should only run if a file is changed, is that possible?

Edit: see #1381

@cammarb
Copy link

cammarb commented Jul 24, 2021

I've been experiencing a similar issue. When opening a java project, the java build status is stuck at 68% Refreshing. Also, the extension Java Project and Spring Boot Dashboard never load.

image

I have googled and I haven't found a solution.

Enviroment:

  • Operating System: Windows 10 20H1 build 19043.1110
  • JDK version: 16.0.1
  • Visual Studio Code version: 1.58.2

@snjeza
Copy link
Contributor

snjeza commented Jul 24, 2021

@cammarb Could you check #2020 (comment)

@ianmarxent
Copy link

I had a similar issue; stuck building and would never finish. I checked out the troubleshooting guide here and found that cleaning out my workspace directory solved the problem for me (steps from link pasted below):

  • Open the command palette
  • select Java: Clean the Java Language Server Workspace
  • select Restart and delete from the confirmation prompt

@SlappyAUS
Copy link

Has anyone been able to solve this? I am running since adding WSDL code gen though maven plugin cxf-codegen-plugin, VSCode won stop iterating over "Building" -> "Refreshing Workspace" in the Java Build Status Console. Very high temperatures and CPU usage.

@ralphavalon
Copy link

@SlappyAUS so, what @snjeza posted actually solves it. It just sucks that, until today, I still need to do it. I wish this was just fixed already.

@jterry-viacomcbs
Copy link

@ianmarxent bless you, this has saved me so much work, i've been blowing away these things by hand for months

@rafaelceravolo
Copy link

@fo-fo if you change the java trace setting to "verbose", you will see the full logs about "workspace/didChangeWatchedFiles" notification.

@fo-fo or @testforstephen I have the same problem (code keeps recompiling). Following your suggestion, I found the configuration to set to "verbose", but didn't find where the logs are logged.

Where can I see them?

@henry2man
Copy link

After some time having these issues, I've noticed that the problem went away. I'm mostly sure that I haven't changed anything. Maybe this is solved? What are your experiences these days?

@ianmarxent
Copy link

@henry2man I agree, I haven't seen this issue crop up recently. This may have been resolved in an update.

@snjeza
Copy link
Contributor

snjeza commented May 9, 2022

This issue has been fixed with eclipse-jdtls/eclipse.jdt.ls#1816

@snjeza snjeza closed this as completed May 9, 2022
@blogger1233
Copy link

i also face the same problem

@snjeza
Copy link
Contributor

snjeza commented Aug 6, 2022

@Dhruv1233 could you, please, provide a project example reproducing the error?

@m-alcu
Copy link

m-alcu commented Aug 25, 2022

I get the error with win10, version 1.70.2
I have created a java proyect from scratch "demo" from java from VSCode ("No build tools"). Any project same results.

@ToughKnee
Copy link

ToughKnee commented Oct 23, 2022

This problem may be because java process extension may be killed by another extension, my problem was seeing java extension doing its thing starting the projects normally and seconds later just stopped and getting stuck in an infinite loop trying to run.
My solution was disbaling ALL extensions except java debugger and java redhat extension, restarting vs code and then I saw java finally working in vs code, then re enabled all the extensions and I was good to go

Hope it works if you're having that problem

@alahaouas
Copy link

alahaouas commented Dec 13, 2022

I tried the F1 "Java clean ..." action but the issue is still occurring.

I make no changes to the Java code or to any file, just browsing the project.
And I notice in the "Java Build Status" terminal that building/validation/publishing/registering/etc... goes in a loop.
Then, I see via htop command that the Redhat extension uses lots of CPU.

I think the issue is still happening.

@RollerKing
Copy link

me too, I just open https://github.com/apache/pulsar on wsl using vscode server, and "Java Build Status" is repeating in a loop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests