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

Recurring AssertionError in reconciler #980

Open
mickaelistria opened this issue Nov 25, 2024 · 3 comments
Open

Recurring AssertionError in reconciler #980

mickaelistria opened this issue Nov 25, 2024 · 3 comments

Comments

@mickaelistria
Copy link

java.lang.AssertionError
	at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:155)
	at jdk.compiler/com.sun.tools.javac.util.Assert.checkNonNull(Assert.java:62)
	at jdk.compiler/com.sun.tools.javac.comp.Modules.allModules(Modules.java:1225)
	at jdk.compiler/com.sun.tools.javac.comp.Modules$3.complete(Modules.java:1467)
	at jdk.compiler/com.sun.tools.javac.code.Symbol.complete(Symbol.java:687)
	at jdk.compiler/com.sun.tools.javac.code.ClassFinder.fillIn(ClassFinder.java:554)
	at jdk.compiler/com.sun.tools.javac.code.ClassFinder.complete(ClassFinder.java:311)
	at jdk.compiler/com.sun.tools.javac.code.Symbol.complete(Symbol.java:687)
	at jdk.compiler/com.sun.tools.javac.code.Symbol$PackageSymbol.members(Symbol.java:1183)
	at jdk.compiler/com.sun.tools.javac.code.Symtab.listPackageModules(Symtab.java:902)
	at jdk.compiler/com.sun.tools.javac.comp.Enter.visitTopLevel(Enter.java:348)
	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:553)
	at jdk.compiler/com.sun.tools.javac.comp.Enter.classEnter(Enter.java:290)
	at jdk.compiler/com.sun.tools.javac.comp.Enter.classEnter(Enter.java:305)
	at jdk.compiler/com.sun.tools.javac.comp.Enter.complete(Enter.java:618)
	at jdk.compiler/com.sun.tools.javac.comp.Enter.main(Enter.java:599)
	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:1077)
	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.enter(JavacTaskImpl.java:345)
	at org.eclipse.jdt.core.dom.JavacBindingResolver.resolve(JavacBindingResolver.java:451)
	at org.eclipse.jdt.core.dom.JavacBindingResolver.resolvePackage(JavacBindingResolver.java:1215)
	at org.eclipse.jdt.core.dom.PackageDeclaration.resolveBinding(PackageDeclaration.java:323)
	at org.eclipse.jdt.core.dom.JavacCompilationUnitResolver.resolveBindings(JavacCompilationUnitResolver.java:458)
	at org.eclipse.jdt.core.dom.JavacCompilationUnitResolver.resolveBindings(JavacCompilationUnitResolver.java:452)
	at org.eclipse.jdt.core.dom.JavacCompilationUnitResolver.toCompilationUnit(JavacCompilationUnitResolver.java:545)
	at org.eclipse.jdt.core.dom.ASTParser.internalCreateASTCached(ASTParser.java:1299)
	at org.eclipse.jdt.core.dom.ASTParser.lambda$1(ASTParser.java:1178)
	at org.eclipse.jdt.internal.core.JavaModelManager.cacheZipFiles(JavaModelManager.java:5694)
	at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:1178)
	at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:918)
	at org.eclipse.jdt.internal.ui.javaeditor.codemining.JavaMethodParameterCodeMiningProvider.getCompilationUnitNode(JavaMethodParameterCodeMiningProvider.java:97)
	at org.eclipse.jdt.internal.ui.javaeditor.codemining.JavaMethodParameterCodeMiningProvider.collectLineContentCodeMinings(JavaMethodParameterCodeMiningProvider.java:86)
	at org.eclipse.jdt.internal.ui.javaeditor.codemining.JavaMethodParameterCodeMiningProvider.lambda$0(JavaMethodParameterCodeMiningProvider.java:68)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1812)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1804)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:507)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1458)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:2034)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:189)

The underlying cause seems to be some IO issue. I suspect that (shared) filemanagers and/or the underlying ZipFileSystems that are cached are not thread-safe by default.

@mickaelistria
Copy link
Author

I could drill down under this error and other similar ones: Sometimes, the cached jars become unreadable and break many things.
One cause is that stack:

Thread [Text Viewer Hover Presenter] (Suspended (breakpoint at line 187 in FileChannelImpl)) (out of synch)	
	owns: Object  (id=47802)	
	owns: JavacTaskImpl  (id=47803)	
	FileChannelImpl.implCloseChannel() line: 187	
	FileChannelImpl(AbstractInterruptibleChannel).close() line: 129	
	AbstractInterruptibleChannel$1.postInterrupt() line: 107	
	FileChannelImpl(AbstractInterruptibleChannel).begin() line: 181	
	FileChannelImpl.beginBlocking() line: 177	
	FileChannelImpl.readInternal(ByteBuffer, long) line: 1181	
	FileChannelImpl.implRead(ByteBuffer, long) line: 1152	
	FileChannelImpl.read(ByteBuffer, long) line: 1134	
	ZipFileSystem.readAt(ByteBuffer, long) line: 1259	
	ZipFileSystem.readNBytesAt(byte[], int, long, long) line: 1247	
	ZipFileSystem$EntryInputStream.initDataPos() line: 2582	
	ZipFileSystem$EntryInputStream.read(byte[], int, int) line: 2524	
	ZipFileSystem$2.fill() line: 2474	
	ZipFileSystem$2(InflaterInputStream).read(byte[], int, int) line: 176	
	ByteBuffer.appendStream(InputStream) line: 167	
	ClassReader.readClassFile(Symbol$ClassSymbol) line: 3096	
	ClassFinder.fillIn(Symbol$ClassSymbol) line: 373	
	ClassFinder.complete(Symbol) line: 302	
	0x00007f073b9727f0.complete(Symbol) line: not available	
	Symbol$ClassSymbol(Symbol).complete() line: 687	
	Symbol$ClassSymbol.complete() line: 1455	
	ClassFinder.loadClass(Symbol$ModuleSymbol, Name) line: 446	
	Resolve.loadClass(Env<AttrContext>, Name, RecoveryLoadClass) line: 2076	
	Resolve.findIdentInPackageInternal(Env<AttrContext>, TypeSymbol, Name, KindSelector) line: 2473	
	Resolve.findIdentInPackage(DiagnosticPosition, Env<AttrContext>, TypeSymbol, Name, KindSelector) line: 2461	
	Attr.selectSym(JCFieldAccess, Symbol, Type, Env<AttrContext>, ResultInfo) line: 4541	
	Attr.visitSelect(JCTree$JCFieldAccess) line: 4433	
	JCTree$JCFieldAccess.accept(JCTree$Visitor) line: 2570	
	Attr.attribTree(JCTree, Env<AttrContext>, ResultInfo) line: 674	
	Attr.attribType(JCTree, Env<AttrContext>, Type) line: 740	
	Attr.attribType(JCTree, Env<AttrContext>) line: 733	
	TypeEnter$ImportsPhase.attribImportType(JCTree, Env<AttrContext>) line: 531	
	TypeEnter$ImportsPhase.doImport(JCTree$JCImport) line: 463	
	TypeEnter$ImportsPhase.handleImports(List<JCImportBase>) line: 416	
	TypeEnter$ImportsPhase.resolveImports(JCCompilationUnit, Env<AttrContext>) line: 389	
	TypeEnter$ImportsPhase.runPhase(Env<AttrContext>) line: 318	
	TypeEnter$ImportsPhase(TypeEnter$Phase).doCompleteEnvs(List<Env<AttrContext>>) line: 279	
	TypeEnter$ImportsPhase(TypeEnter$Phase).completeEnvs(List<Env<AttrContext>>) line: 248	
	TypeEnter.complete(Symbol) line: 195	
	Symbol$ClassSymbol(Symbol).complete() line: 687	
	Symbol$ClassSymbol.complete() line: 1455	
	Enter.complete(List<JCCompilationUnit>, ClassSymbol) line: 632	
	Enter.main(List<JCCompilationUnit>) line: 599	
	JavaCompiler.enterTrees(List<JCCompilationUnit>) line: 1077	
	JavacTaskImpl.enter(Iterable<CompilationUnitTree>) line: 345	
	JavacBindingResolver.resolve() line: 451 (out of synch)	
	JavacBindingResolver.resolvePackage(PackageDeclaration) line: 1221 (out of synch)	
	PackageDeclaration.resolveBinding() line: 323	
	JavacCompilationUnitResolver.resolveBindings(CompilationUnit, Map<String,IBinding>, int) line: 458 (out of synch)	
	JavacCompilationUnitResolver.resolveBindings(CompilationUnit, int) line: 452 (out of synch)	
	JavacCompilationUnitResolver.toCompilationUnit(ICompilationUnit, boolean, IJavaProject, List<Classpath>, int, int, Map<String,String>, WorkingCopyOwner, WorkingCopyOwner, int, IProgressMonitor) line: 545 (out of synch)	
	ASTParser.internalCreateASTCached(IProgressMonitor) line: 1299	
	ASTParser.lambda$1(IProgressMonitor) line: 1178	
	0x00007f073b897cd0.call() line: not available	
	JavaModelManager.cacheZipFiles(JavaCallable<T,E>) line: 5694	
	ASTParser.internalCreateAST(IProgressMonitor) line: 1178	
	ASTParser.createAST(IProgressMonitor) line: 918	
	CoreASTProvider$1.run() line: 294	
	SafeRunner.run(ISafeRunnable) line: 47	
	CoreASTProvider.createAST(ITypeRoot, IProgressMonitor) line: 286	
	CoreASTProvider.getAST(ITypeRoot, CoreASTProvider$WAIT_FLAG, IProgressMonitor) line: 199	
	SharedASTProviderCore.getAST(ITypeRoot, SharedASTProviderCore$WAIT_FLAG, IProgressMonitor) line: 138	
	NLSStringHover.internalGetHoverInfo(ITextViewer, IRegion) line: 141	
	NLSStringHover.getHoverInfo2(ITextViewer, IRegion) line: 120	
	BestMatchHover.getHoverInfo2(ITextViewer, IRegion, boolean) line: 163	
	BestMatchHover.getHoverInfo2(ITextViewer, IRegion) line: 130	
	JavaEditorTextHoverProxy.getHoverInfo2(ITextViewer, IRegion) line: 89	
	TextViewerHoverManager$1.run() line: 155	

When a thread that queries the jar is interrupted, the channel gets interrupted automatically and becomes unusable.
For example, with the stack above, the channel got interrupted because one consumer thread Thread[#575,Text Viewer Hover Presenter,1,main] got interrupted too.
The channels have a setInterruptable() flags that I'll try to ensure gets called for the cached jars.

@mickaelistria
Copy link
Author

#1047 seems to be a good fix so far.

@mickaelistria
Copy link
Author

This is still happening in some cases. Same cause and it looks like the earlier patch doesn't apply to some cases (when release is set but additionalOptions used in CachingJDKPlatformArguments return false (so the cached filemanager is not used)

@mickaelistria mickaelistria reopened this Dec 19, 2024
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

1 participant