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

Infinite loading after update to 1.25.0 #3411

Closed
pingu8007 opened this issue Dec 4, 2023 · 13 comments · Fixed by eclipse-jdtls/eclipse.jdt.ls#2987
Closed

Infinite loading after update to 1.25.0 #3411

pingu8007 opened this issue Dec 4, 2023 · 13 comments · Fixed by eclipse-jdtls/eclipse.jdt.ls#2987

Comments

@pingu8007
Copy link

After update vscode-java to 1.25.0, loading a project is never completed.

Environment
  • Operating System: Ubuntu 22.04 (over Docker Desktop, over WSL2 on Windows 10)
  • JDK version: 17 (Eclipse Adoptium 17.0.8)
  • Visual Studio Code version: 1.84.2
  • Java extension version: stable 1.25.0 / prerelease 1.26.2023120108
Steps To Reproduce
  1. open project
Current Result

Project is loading infinitely, with full CPU usage.
Sometime the language server is end in OutOfMemory error (-Xmx3000m).

Partial output from Build Status panel:

d9ac4536 Setting default character set for resource '/Module-1'. - 68% Module-1
88e3c423 Setting default character set for resource '/Module-2'. - 38% Module-2
af325284 Setting default character set for resource '/Module-3'. - 68% Module-3
ced41a43 Setting default character set for resource '/Module-4'. - 68% Module-4
732bc867 Setting default character set for resource '/Module-5'. - 58% Module-5
db0149e4 Setting default character set for resource '/Module-5b'. - 68% Module-5b
6ea8f7ab Update project Module-5 - 5% project Module-5
4e0a3156 Setting default character set for resource '/Module-6'. - 58% Module-6
f3905bae Setting default character set for resource '/Module-6'. - 68% Module-6
3c8eabe6 Setting default character set for resource '/Module-7'. - 68% Module-7
7ea37365 Setting default character set for resource '/Module-7b'. - 68% Module-7b
4c051edf Setting classpath containers - 37% project Module-8
4a8e09fb Setting default character set for resource '/Module-9'. - 68% Module-9
2b975bf5 Update project Module-10 - 0% Refreshing '/Module-10'.
b0ec73b0 Setting default character set for resource '/Module-10a'. - 68% Module-10a
07426617 Setting classpath containers - 37% project Module-10b
f9bfa629 Setting default character set for resource '/Module-11b'. - 58% Module-11b
35bcdfb0 Setting default character set for resource '/Module-11a'. - 68% Module-11a
6d34a44c Update project Module-11b - 1% Refreshing '/Module-11b'.
Expected Result

Finish loading in few minutes (1.24.0 can finish loading in 5min).

Additional Informations
  1. It's internal project and I can't provide details but only environment and vscode configuration.
  2. This project has 20+ modules and is more than 600MB.
  3. This project is java+kotlin mixed, but I'm only working java parts.
@testforstephen
Copy link
Collaborator

Any further information on logs? You can run "F1 -> Java: Open Java Language Server Log File" to get the log.

@pingu8007
Copy link
Author

@testforstephen I found there are OOM errors not reported in the notification. However, even increasing the heap size to 8g (4 times then 1.24.0 required) can't resolve the OOM error.

bak_0.log

@testforstephen
Copy link
Collaborator

!ENTRY org.eclipse.jdt.core 4 4 2023-12-04 07:01:22.562
!MESSAGE Search failed for index Index for /$MODULE_20
!STACK 0
java.io.IOException: Failed to read index data from file:/appdata/.vscode-server/data/User/workspaceStorage/4e97a51aeba2aad9206659b97b054cb6/redhat.java/jdt_ws/.metadata/.plugins/org.eclipse.jdt.core/4170031126.index at offset 208878 and size 1918985317
	at org.eclipse.jdt.internal.core.index.DiskIndex.readCategoryTable(DiskIndex.java:686)
	at org.eclipse.jdt.internal.core.index.DiskIndex.addQueryResults(DiskIndex.java:239)
	at org.eclipse.jdt.internal.core.index.Index.query(Index.java:172)
	at org.eclipse.jdt.internal.core.search.matching.SecondaryTypeDeclarationPattern.queryIn(SecondaryTypeDeclarationPattern.java:47)
	at org.eclipse.jdt.core.search.SearchPattern.findIndexMatches(SearchPattern.java:2517)
	at org.eclipse.jdt.core.search.SearchPattern.findIndexMatches(SearchPattern.java:2489)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.findIndexMatches(MatchLocator.java:310)
	at org.eclipse.jdt.internal.core.search.PatternSearchJob.search(PatternSearchJob.java:240)
	at org.eclipse.jdt.internal.core.search.PatternSearchJob.search(PatternSearchJob.java:214)
	at org.eclipse.jdt.internal.core.search.PatternSearchJob.lambda$0(PatternSearchJob.java:150)
	at java.base/java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinTask.awaitDone(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinTask.get(Unknown Source)
	at org.eclipse.jdt.internal.core.search.PatternSearchJob.performParallelSearch(PatternSearchJob.java:156)
	at org.eclipse.jdt.internal.core.search.PatternSearchJob.execute(PatternSearchJob.java:117)
	at org.eclipse.jdt.internal.core.search.processing.JobManager.performConcurrentJob(JobManager.java:288)
	at org.eclipse.jdt.internal.core.search.BasicSearchEngine.searchAllSecondaryTypeNames(BasicSearchEngine.java:1716)
	at org.eclipse.jdt.internal.core.JavaModelManager.secondaryTypesSearching(JavaModelManager.java:5119)
	at org.eclipse.jdt.internal.core.JavaModelManager.secondaryTypes(JavaModelManager.java:4967)
	at org.eclipse.jdt.internal.core.search.matching.ClasspathSourceDirectory.directoryTable(ClasspathSourceDirectory.java:82)
	at org.eclipse.jdt.internal.core.search.matching.ClasspathSourceDirectory.isPackage(ClasspathSourceDirectory.java:148)
	at org.eclipse.jdt.internal.core.search.matching.JavaSearchNameEnvironment.getModulesDeclaringPackage(JavaSearchNameEnvironment.java:501)
	at org.eclipse.jdt.internal.compiler.env.IModuleAwareNameEnvironment.getUniqueModulesDeclaringPackage(IModuleAwareNameEnvironment.java:113)
	at org.eclipse.jdt.internal.compiler.lookup.ModuleBinding$UnNamedModule.getDeclaredPackage(ModuleBinding.java:102)
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createPlainPackage(LookupEnvironment.java:1102)
	at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.buildTypeBindings(CompilationUnitScope.java:138)
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.buildTypeBindings(LookupEnvironment.java:502)
	at org.eclipse.jdt.internal.core.search.indexing.SourceIndexer.resolveDocument(SourceIndexer.java:170)
	at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.resolveDocument(JavaSearchParticipant.java:117)
	at org.eclipse.jdt.internal.core.search.indexing.IndexManager.indexResolvedDocument(IndexManager.java:681)
	at org.eclipse.jdt.internal.core.search.indexing.IndexManager$2.execute(IndexManager.java:1292)
	at org.eclipse.jdt.internal.core.search.processing.JobManager.indexerLoop(JobManager.java:543)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.OutOfMemoryError: Java heap space
	at org.eclipse.jdt.internal.compiler.util.HashtableOfObject.<init>(HashtableOfObject.java:58)
	at org.eclipse.jdt.internal.core.index.DiskIndex.readCategoryTable(DiskIndex.java:682)
	at org.eclipse.jdt.internal.core.index.DiskIndex.addQueryResults(DiskIndex.java:239)
	at org.eclipse.jdt.internal.core.index.Index.query(Index.java:172)
	at org.eclipse.jdt.internal.core.search.matching.SecondaryTypeDeclarationPattern.queryIn(SecondaryTypeDeclarationPattern.java:47)
	at org.eclipse.jdt.core.search.SearchPattern.findIndexMatches(SearchPattern.java:2517)
	at org.eclipse.jdt.core.search.SearchPattern.findIndexMatches(SearchPattern.java:2489)
	at org.eclipse.jdt.internal.core.search.matching.MatchLocator.findIndexMatches(MatchLocator.java:310)
	at org.eclipse.jdt.internal.core.search.PatternSearchJob.search(PatternSearchJob.java:240)
	at org.eclipse.jdt.internal.core.search.PatternSearchJob.search(PatternSearchJob.java:214)
	at org.eclipse.jdt.internal.core.search.PatternSearchJob.lambda$0(PatternSearchJob.java:150)
	at org.eclipse.jdt.internal.core.search.PatternSearchJob$$Lambda$585/0x000000080073b7b8.call(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinTask.awaitDone(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinTask.get(Unknown Source)
	at org.eclipse.jdt.internal.core.search.PatternSearchJob.performParallelSearch(PatternSearchJob.java:156)
	at org.eclipse.jdt.internal.core.search.PatternSearchJob.execute(PatternSearchJob.java:117)
	at org.eclipse.jdt.internal.core.search.processing.JobManager.performConcurrentJob(JobManager.java:288)
	at org.eclipse.jdt.internal.core.search.BasicSearchEngine.searchAllSecondaryTypeNames(BasicSearchEngine.java:1716)
	at org.eclipse.jdt.internal.core.JavaModelManager.secondaryTypesSearching(JavaModelManager.java:5119)
	at org.eclipse.jdt.internal.core.JavaModelManager.secondaryTypes(JavaModelManager.java:4967)
	at org.eclipse.jdt.internal.core.search.matching.ClasspathSourceDirectory.directoryTable(ClasspathSourceDirectory.java:82)
	at org.eclipse.jdt.internal.core.search.matching.ClasspathSourceDirectory.isPackage(ClasspathSourceDirectory.java:148)
	at org.eclipse.jdt.internal.core.search.matching.JavaSearchNameEnvironment.getModulesDeclaringPackage(JavaSearchNameEnvironment.java:501)
	at org.eclipse.jdt.internal.compiler.env.IModuleAwareNameEnvironment.getUniqueModulesDeclaringPackage(IModuleAwareNameEnvironment.java:113)
	at org.eclipse.jdt.internal.compiler.lookup.ModuleBinding$UnNamedModule.getDeclaredPackage(ModuleBinding.java:102)
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createPlainPackage(LookupEnvironment.java:1102)
	at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.buildTypeBindings(CompilationUnitScope.java:138)
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.buildTypeBindings(LookupEnvironment.java:502)
	at org.eclipse.jdt.internal.core.search.indexing.SourceIndexer.resolveDocument(SourceIndexer.java:170)
	at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.resolveDocument(JavaSearchParticipant.java:117)

Looks like the index files are broken and cause out-of-memory. Could you try "F1 -> Java: Clean Java Language Server Workspace"?

@testforstephen
Copy link
Collaborator

@rgrunber We also noticed that the out-of-memory ratio increases in recent version 1.25.0. Any thoughts on this?

@pingu8007
Copy link
Author

@testforstephen No. Clean Java Language Server Workspace doesn't resolve this issue.

While increasing heap size improve the responsive and the increase the chance of success startup, the increment is not acceptable and is not always work.

@Wroud
Copy link

Wroud commented Dec 4, 2023

same here macos 14.1.1 (23B81)

@kjq
Copy link

kjq commented Dec 4, 2023

Seeing similar issues as well with an average size multi-module Maven project running within WSL

CPU is pegged and VSCode goes into a tizzy.

The "Java Projects" extension rarely completes and resetting the language server does not help. Additionally, it seems the POM's fail to resolve more frequently as well.

Downgrading to 1.24.0 seems to work fine.

@testforstephen
Copy link
Collaborator

@kjq @Wroud Could you please share more information about your case so that we can better understand the problem. Are you seeing any out of memory errors in the server logs? Appreciate if anyone can share some sample project that we can use to reproduce the issue.

@rgrunber
Copy link
Member

rgrunber commented Dec 4, 2023

@testforstephen I found there are OOM errors not reported in the notification. However, even increasing the heap size to 8g (4 times then 1.24.0 required) can't resolve the OOM error.

bak_0.log

Looking in the attached logs, the OOM errors come much later, but the errors I'm seeing are of the form :

!ENTRY org.eclipse.jdt.apt.core 4 1 2023-12-04 07:00:09.289
!MESSAGE Could not get factory containers for project: $MODULE_1
!STACK 1
org.eclipse.core.internal.resources.ResourceException(/$MODULE_1/.factorypath)[368]: java.lang.Exception: File not found: /appdata/.vscode-server/data/User/workspaceStorage/4e97a51aeba2aad9206659b97b054cb6/redhat.java/jdt_ws/.metadata/.plugins/org.eclipse.core.resources/.projects/$MODULE_1/.factorypath.
    at org.eclipse.core.internal.resources.ResourceException.provideStackTrace(ResourceException.java:42)
    at org.eclipse.core.internal.resources.ResourceException.<init>(ResourceException.java:38)
    at org.eclipse.core.internal.localstore.FileSystemResourceManager.read(FileSystemResourceManager.java:881)
    at org.eclipse.core.internal.resources.File.getContents(File.java:298)
    at org.eclipse.jdt.apt.core.internal.util.FileSystemUtil.getContentsOfIFile(FileSystemUtil.java:134)
    at org.eclipse.jdt.apt.core.internal.util.FactoryPathUtil.readFactoryPathFile(FactoryPathUtil.java:110)
    at org.eclipse.jdt.apt.core.internal.util.FactoryPathUtil.calculatePath(FactoryPathUtil.java:345)
    at org.eclipse.jdt.apt.core.internal.util.FactoryPathUtil.getFactoryPath(FactoryPathUtil.java:432)
    at org.eclipse.jdt.apt.core.internal.AnnotationProcessorFactoryLoader.getJava6FactoriesAndAttributesForProject(AnnotationProcessorFactoryLoader.java:456)
    at org.eclipse.jdt.internal.apt.pluggable.core.dispatch.IdeAnnotationProcessorManager.processAnnotations(IdeAnnotationProcessorManager.java:134)
    at org.eclipse.jdt.internal.compiler.Compiler.processAnnotations(Compiler.java:953)
    at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:450)
    at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:426)
...
...

Seems like an issue with JDT Annotation Processing. .factorypath is one of the files we relocate using the JLS filesystem bundle but seems it isn't being located.

Update: Fred seems to think it might be unrelated so if there's any examples that don't use annotation processing, then it isn't related.

@kjq
Copy link

kjq commented Dec 4, 2023

@testforstephen - from my side, not a lot that I can share as a reproducer except these details:

  • Everything seems to work fine with 1.24.0 (what I was using before and just downgraded back to)
  • Working within an average sized Maven multi-module project in WSL2 (mostly Java projects but there are others in the workspace).
  • The Maven project uses Maven-friendly "versions" (i.e. <version>${revision}${changelist}</version>)
  • One of the primary plugins used is the Quarkus Maven Plugin
  • Vmmem would run at about 100% (I realized this when my fan kept churning - downgrading it runs about 10-15% CPU).
  • Resetting the language server, graphics card, etc. did not help (i even reinstalled VSCode as this seems to be a monthly thing).
  • In my WSL2 terminal it would bring everything to a standstill, eventually VSCode would lose its connection to WSL.
  • The Java Project Manager would rarely finish (and it continually reported Building). If it did I would have a variety of errors but mostly the one below.

Ill try to upgrade again later today and collect more details but I cant afford the downtime at the moment.

Oddly, upgrading also seems to throw numerous errors about the execution phases of the Quarkus plugin failing on various "code generation" executions and the error would change. The root of this error was related to something to do with the Zip filestream.

@snjeza snjeza self-assigned this Dec 4, 2023
@snjeza
Copy link
Contributor

snjeza commented Dec 4, 2023

@pingu8007 @kjq @Wroud Could, you, please, check VS Code 1.27.0 ?

@pingu8007
Copy link
Author

@snjeza Yes, it works with 4g heap size in 9min (both are twice then 1.24.0 required, language server workspace is cleared).

1_27_0-mx4g.log

@Wroud
Copy link

Wroud commented Dec 5, 2023

My project is https://github.com/dbeaver/dbeaver
I use combination of yaozheng.vscode-pde (Eclipse PDE support) with vscjava.vscode-java-pack (Extension Pack for Java)

to work with my project, I need firstly "Import existing maven project" in Eclipse (to generate .project, .classpaths files) then I can work with project in VSCode (vscode don't recognize maven projects as java projects till imported in Eclipse)

@snjeza 1.27.0 also works for me

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

Successfully merging a pull request may close this issue.

6 participants