Repository navigation
Closed
Labels
for: eclipsesomething that is specific for Eclipsestatus: needs-investigationtheme: refactoringtype: bug
Milestone
Description
I have opened a Java source file, this triggered a language server to be started, then seeing this exception in the language server log output:
13:37:31.349 [Project-Reconciler-3] ERROR o.s.i.v.b.j.r.RewriteReconciler -
io.github.classgraph.ClassGraphException: Uncaught exception during scan
at io.github.classgraph.ClassGraph.scan(ClassGraph.java:1606)
at io.github.classgraph.ClassGraph.scan(ClassGraph.java:1623)
at io.github.classgraph.ClassGraph.scan(ClassGraph.java:1636)
at org.openrewrite.java.marker.JavaSourceSet.build(JavaSourceSet.java:78)
at org.openrewrite.java.isolated.ReloadableJava17Parser.getSourceSet(ReloadableJava17Parser.java:304)
at org.openrewrite.java.isolated.ReloadableJava17Parser.parseInputs(ReloadableJava17Parser.java:202)
at org.openrewrite.java.Java17Parser.parseInputs(Java17Parser.java:38)
at org.springframework.ide.vscode.commons.rewrite.java.ORAstUtils.parseInputs(ORAstUtils.java:293)
at org.springframework.ide.vscode.boot.java.rewrite.RewriteReconciler.reconcile(RewriteReconciler.java:146)
at org.springframework.ide.vscode.boot.java.handlers.BootJavaReconcileEngine.reconcile(BootJavaReconcileEngine.java:152)
at org.springframework.ide.vscode.boot.app.BootLanguageServerInitializer.lambda$validateProject$8(BootLanguageServerInitializer.java:219)
at java.base/java.util.Optional.ifPresent(Optional.java:178)
at org.springframework.ide.vscode.boot.app.BootLanguageServerInitializer.lambda$validateProject$9(BootLanguageServerInitializer.java:218)
at reactor.core.publisher.MonoPeekTerminal$MonoTerminalPeekSubscriber.onNext(MonoPeekTerminal.java:171)
at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:539)
at reactor.core.publisher.MonoPublishOn$PublishOnSubscriber.run(MonoPublishOn.java:181)
at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:68)
at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:28)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.OutOfMemoryError: Java heap space
at nonapi.io.github.classgraph.fileslice.reader.ClassfileReader.<init>(ClassfileReader.java:150)
at io.github.classgraph.ClasspathElementZip$1.openClassfile(ClasspathElementZip.java:376)
at io.github.classgraph.Classfile.<init>(Classfile.java:1969)
at io.github.classgraph.Scanner$ClassfileScannerWorkUnitProcessor.processWorkUnit(Scanner.java:719)
at io.github.classgraph.Scanner$ClassfileScannerWorkUnitProcessor.processWorkUnit(Scanner.java:641)
at nonapi.io.github.classgraph.concurrency.WorkQueue.runWorkLoop(WorkQueue.java:246)
at nonapi.io.github.classgraph.concurrency.WorkQueue.access$000(WorkQueue.java:50)
at nonapi.io.github.classgraph.concurrency.WorkQueue$1.call(WorkQueue.java:201)
at nonapi.io.github.classgraph.concurrency.WorkQueue$1.call(WorkQueue.java:198)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
... 3 common frames omitted
Metadata
Metadata
Assignees
Labels
for: eclipsesomething that is specific for Eclipsestatus: needs-investigationtheme: refactoringtype: bug
Activity
martinlippert commentedon Nov 21, 2022
There is nothing dramatic in the workspace:
martinlippert commentedon Nov 21, 2022
Interestingly, when closing the java source file again, waiting for the language server to shut down, and then re-opening a java file, a new language server process gets created - this time without showing up the memory issue. Strange...
martinlippert commentedon Nov 22, 2022
I am looking into this in a bit more detail. The language server is set to
-Xmx1024mand my workspace is fairly small. Nevertheless I seeOutOfMemoryError: Java heap spaceproblems appearing continuously.The thread dumps reveal many threads around OpenRewrite.
First, there is a huge number of threads being idle. Do we need to have so many threads created and waiting for some work to do? I count 24:
Then, we have a huge number of threads doing stuff around OpenRewrite. Again 24 (!!!) threads doing OpenRewrite stuff:
Then, we have a few remaining threads running around OpenRewrite and the reconciling that we are doing:
martinlippert commentedon Nov 22, 2022
I am sorry, but this looks way too much to happen in the background when - more or less - doing nothing in the IDE. The easiest way to trigger this seems to have a language server running and then switch the project to another revision/tag/branch. I used petclinic in here, so nothing dramatically large.
martinlippert commentedon Nov 22, 2022
When I disable the OpenRewrite based reconciling, the memory usage stays within reasonable bounds, even when I execute the SB3 conversion via the dialog. However, when I enable the OpenRewrite reconciling, you can see the immediate spike in memory usage. The fast majority of this memory is being GC'ed once the reconciling is done (if you trigger a GC, for example), but nevertheless it is using a large chunk of memory while doing the reconciling and I wonder what happens if I have a larger workspace with reasonably sized projects in there.
[-][refactoring] OutOfHeapSpace exception[/-][+][refactoring] OutOfMemoryError: Java Heap Space[/+]BoykoAlex commentedon Nov 23, 2022
Looked to me like it is just a spike in the heap usage when a lot of projects being reconciled. There is support to allow 3 projects being reconciled in parallel. Once the spike is gone heap is around 120Mb for me. Therefore, I went with the suggestion from Rewrite to set
SKIP_SOURCE_SET_TYPE_GENERATIONback for the parser Pushed a919463. Please give it another try @martinlippert. Seemed like it worked for me but I'll keep an eye out forOutOfMemoryErrormartinlippert commentedon Nov 24, 2022
I gave this another try and it seems to behave nicely now with a heap limited to -Xmx1024m. :-)