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

Dependency module <dependencies of main> was not initialized by the time contents of dependent module <dependencies of main> were queried #542

Open
fwcd opened this issue Jan 15, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@fwcd
Copy link
Owner

fwcd commented Jan 15, 2024

Every now and then the tests spuriously fail with this error:

org.javacs.kt.EditFunctionTest > edit a function in a script FAILED
    java.lang.AssertionError: Dependency module <dependencies of main> was not initialized by the time contents of dependent module <dependencies of main> were queried
Full stack trace (click to expand)
org.javacs.kt.EditFunctionTest > edit a function in a script FAILED
    java.lang.AssertionError: Dependency module <dependencies of main> was not initialized by the time contents of dependent module <dependencies of main> were queried
        at org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl$packageFragmentProviderForWholeModuleWithDependencies$2.invoke(ModuleDescriptorImpl.kt:96)
        at org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl$packageFragmentProviderForWholeModuleWithDependencies$2.invoke(ModuleDescriptorImpl.kt:90)
        at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
        at org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl.getPackageFragmentProviderForWholeModuleWithDependencies(ModuleDescriptorImpl.kt:90)
        at org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl.getPackageFragmentProvider(ModuleDescriptorImpl.kt:151)
        at org.jetbrains.kotlin.descriptors.impl.LazyPackageViewDescriptorImpl$empty$2.invoke(LazyPackageViewDescriptorImpl.kt:39)
        at org.jetbrains.kotlin.descriptors.impl.LazyPackageViewDescriptorImpl$empty$2.invoke(LazyPackageViewDescriptorImpl.kt:38)
        at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedLazyValue.invoke(LockBasedStorageManager.java:408)
        at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedNotNullLazyValue.invoke(LockBasedStorageManager.java:527)
        at org.jetbrains.kotlin.storage.StorageKt.getValue(storage.kt:42)
        at org.jetbrains.kotlin.descriptors.impl.LazyPackageViewDescriptorImpl.getEmpty(LazyPackageViewDescriptorImpl.kt:38)
        at org.jetbrains.kotlin.descriptors.impl.LazyPackageViewDescriptorImpl.isEmpty(LazyPackageViewDescriptorImpl.kt:42)
        at org.jetbrains.kotlin.cli.jvm.compiler.CliKotlinAsJavaSupport.packageExists(CliKotlinAsJavaSupport.kt:86)
        at org.jetbrains.kotlin.asJava.finder.KtLightPackage.isValid(KtLightPackage.java:35)
        at com.intellij.psi.util.PsiUtilCore.ensureValid(PsiUtilCore.java:470)
        at com.intellij.psi.impl.source.resolve.ResolveCache.ensureValidPsi(ResolveCache.java:273)
        at com.intellij.psi.impl.source.resolve.ResolveCache.ensureValidResults(ResolveCache.java:266)
        at com.intellij.psi.impl.source.resolve.ResolveCache.resolve(ResolveCache.java:243)
        at com.intellij.psi.impl.source.resolve.ResolveCache.resolveWithCaching(ResolveCache.java:184)
        at com.intellij.psi.impl.source.tree.java.PsiReferenceExpressionImpl$OurGenericsResolver$1.elementFinished(PsiReferenceExpressionImpl.java:222)
        at com.intellij.psi.JavaRecursiveElementWalkingVisitor$1.elementFinished(JavaRecursiveElementWalkingVisitor.java:35)
        at com.intellij.psi.JavaRecursiveElementWalkingVisitor$1.elementFinished(JavaRecursiveElementWalkingVisitor.java:32)
        at com.intellij.util.WalkingState.next(WalkingState.java:94)
        at com.intellij.util.WalkingState.walkChildren(WalkingState.java:58)
        at com.intellij.util.WalkingState.elementStarted(WalkingState.java:49)
        at com.intellij.psi.PsiWalkingState.elementStarted(PsiWalkingState.java:76)
        at com.intellij.psi.JavaRecursiveElementWalkingVisitor.visitElement(JavaRecursiveElementWalkingVisitor.java:41)
        at com.intellij.psi.impl.source.tree.java.PsiReferenceExpressionImpl$OurGenericsResolver$1.visitReferenceExpression(PsiReferenceExpressionImpl.java:215)
        at com.intellij.psi.impl.source.tree.java.PsiReferenceExpressionImpl.accept(PsiReferenceExpressionImpl.java:777)
        at com.intellij.psi.impl.source.tree.java.PsiReferenceExpressionImpl$OurGenericsResolver.resolveAllQualifiers(PsiReferenceExpressionImpl.java:205)
        at com.intellij.psi.impl.source.tree.java.PsiReferenceExpressionImpl$OurGenericsResolver.resolve(PsiReferenceExpressionImpl.java:182)
        at com.intellij.psi.impl.source.tree.java.PsiReferenceExpressionImpl$OurGenericsResolver.resolve(PsiReferenceExpressionImpl.java:173)
        at com.intellij.psi.impl.source.resolve.ResolveCache.lambda$resolveWithCaching$2(ResolveCache.java:184)
        at com.intellij.openapi.util.Computable.get(Computable.java:18)
        at com.intellij.psi.impl.source.resolve.ResolveCache.lambda$loggingResolver$4(ResolveCache.java:260)
        at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:114)
        at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:44)
        at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:68)
        at com.intellij.psi.impl.source.resolve.ResolveCache.resolve(ResolveCache.java:237)
        at org.javacs.kt.completion.CompletionsKt.explodeConstructors(Completions.kt:503)
        at org.javacs.kt.completion.CompletionsKt.access$explodeConstructors(Completions.kt:1)
        at org.javacs.kt.completion.CompletionsKt$identifiers$2.invoke(Completions.kt:491)
        at org.javacs.kt.completion.CompletionsKt$identifiers$2.invoke(Completions.kt:491)
        at kotlin.sequences.FlatteningSequence$iterator$1.ensureItemIterator(Sequences.kt:315)
        at kotlin.sequences.FlatteningSequence$iterator$1.hasNext(Sequences.kt:303)
        at kotlin.sequences.FilteringSequence$iterator$1.calcNext(Sequences.kt:169)
        at kotlin.sequences.FilteringSequence$iterator$1.hasNext(Sequences.kt:194)
        at kotlin.sequences.SequencesKt___SequencesKt.toCollection(_Sequences.kt:787)
        at kotlin.sequences.SequencesKt___SequencesKt.toMutableList(_Sequences.kt:826)
        at kotlin.sequences.SequencesKt___SequencesKt$sortedWith$1.iterator(_Sequences.kt:638)
        at kotlin.sequences.FilteringSequence$iterator$1.<init>(Sequences.kt:164)
        at kotlin.sequences.FilteringSequence.iterator(Sequences.kt:163)
        at kotlin.sequences.TransformingSequence$iterator$1.<init>(Sequences.kt:208)
        at kotlin.sequences.TransformingSequence.iterator(Sequences.kt:207)
        at kotlin.sequences.SequencesKt___SequencesKt.toList(_Sequences.kt:808)
        at org.javacs.kt.completion.CompletionsKt.completions(Completions.kt:65)
        at org.javacs.kt.KotlinTextDocumentService$completion$1.invoke(KotlinTextDocumentService.kt:156)
        at org.javacs.kt.KotlinTextDocumentService$completion$1.invoke(KotlinTextDocumentService.kt:151)
        at org.javacs.kt.util.AsyncExecutor.compute$lambda$2(AsyncExecutor.kt:19)
        at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
        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:840)

Since it looks like a race condition, we should investigate whether this is an issue with the language server or the Kotlin compiler.

@fwcd fwcd added the bug Something isn't working label Jan 15, 2024
@fwcd
Copy link
Owner Author

fwcd commented Jan 15, 2024

This test repeatedly triggered the issue:

@Ignore
class HoverRecoverTest : SingleFileTestFixture("hover", "Recover.kt") {

Therefore it might be a good starting point to investigate this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant