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

Error: Frame states being merged are incompatible #3342

Closed
smallshen opened this issue Apr 12, 2021 · 20 comments
Closed

Error: Frame states being merged are incompatible #3342

smallshen opened this issue Apr 12, 2021 · 20 comments

Comments

@smallshen
Copy link

smallshen commented Apr 12, 2021

Error: Frame states being merged are incompatible: unbalanced monitors - locked objects do not match
 This frame state: [locals: [1,2,67,57,80,82,83,83,83,83,5] stack: [108] locks: [93 / 84] rethrowException]
Other frame state: [locals: [1,2,183,184,317,318,319,319,319,319,5] stack: [320] locks: [321 / 294] rethrowException]
Parser context: androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2.invokeSuspend(Recomposer.kt:402) [bci: 167, intrinsic: false]
 167: invokestatic  #11         // androidx.compose.runtime.Recomposer.access$getHasFrameWorkLocked:(androidx.compose.runtime.Recomposer)boolean
 170: ifne          194
 173: aload         5
 175: invokestatic  #12         // androidx.compose.runtime.Recomposer.access$recordComposerModificationsLocked:(androidx.compose.runtime.Recomposer)void

Detailed message:
Call path from entry point to androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2.invokeSuspend(Object):
        at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2.invokeSuspend(Recomposer.kt)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
        at com.oracle.svm.core.jdk.RuntimeSupport.executeHooks(RuntimeSupport.java:125)
        at com.oracle.svm.core.jdk.RuntimeSupport.executeStartupHooks(RuntimeSupport.java:75)
        at com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:137)
        at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:182)
        at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)

Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
Error: Image build request failed with exit status 1
com.oracle.svm.driver.NativeImage$NativeImageError: Image build request failed with exit status 1
        at com.oracle.svm.driver.NativeImage.showError(NativeImage.java:1676)
        at com.oracle.svm.driver.NativeImage.build(NativeImage.java:1426)
        at com.oracle.svm.driver.NativeImage.performBuild(NativeImage.java:1387)
        at com.oracle.svm.driver.NativeImage.main(NativeImage.java:1374)
        at com.oracle.svm.driver.NativeImage$JDK9Plus.main(NativeImage.java:1858)

In compatible with coroutines in Jetpack Compose Desktop when adding "--no-fallback" option for generating native image

Version: graalvm-ce-java11-21.0.0.2

@smallshen
Copy link
Author

smallshen commented Apr 16, 2021

More detail

[EridaniLauncher-windows-x64-1.0.0:121600]    classlist:   1,466.17 ms,  0.96 GB
[EridaniLauncher-windows-x64-1.0.0:121600]        (cap):   1,514.25 ms,  0.96 GB
[EridaniLauncher-windows-x64-1.0.0:121600]        setup:   3,272.85 ms,  0.96 GB
[EridaniLauncher-windows-x64-1.0.0:121600]     (clinit):     452.96 ms,  3.25 GB
[EridaniLauncher-windows-x64-1.0.0:121600]   (typeflow):  11,234.08 ms,  3.25 GB
[EridaniLauncher-windows-x64-1.0.0:121600]    (objects):  10,943.67 ms,  3.25 GB
[EridaniLauncher-windows-x64-1.0.0:121600]   (features):     615.83 ms,  3.25 GB
[EridaniLauncher-windows-x64-1.0.0:121600]     analysis:  23,957.98 ms,  3.25 GB
Error: Frame states being merged are incompatible: unbalanced monitors - locked objects do not match
 This frame state: [locals: [1,2,67,57,80,82,83,83,83,83,5] stack: [108] locks: [93 / 84] rethrowException]
Other frame state: [locals: [1,2,183,184,317,318,319,319,319,319,5] stack: [320] locks: [321 / 294] rethrowException]
Parser context: androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2.invokeSuspend(Recomposer.kt:402) [bci: 167, intrinsic: false]
 167: invokestatic  #11         // androidx.compose.runtime.Recomposer.access$getHasFrameWorkLocked:(androidx.compose.runtime.Recomposer)boolean
 170: ifne          194
 173: aload         5
 175: invokestatic  #12         // androidx.compose.runtime.Recomposer.access$recordComposerModificationsLocked:(androidx.compose.runtime.Recomposer)void

Detailed message:
Call path from entry point to androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2.invokeSuspend(Object):
        at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2.invokeSuspend(Recomposer.kt)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
        at com.oracle.svm.core.jdk.RuntimeSupport.executeHooks(RuntimeSupport.java:125)
        at com.oracle.svm.core.jdk.RuntimeSupport.executeStartupHooks(RuntimeSupport.java:75)
        at com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:137)
        at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:182)
        at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)

com.oracle.svm.core.util.UserError$UserException: Frame states being merged are incompatible: unbalanced monitors - locked objects do not match
 This frame state: [locals: [1,2,67,57,80,82,83,83,83,83,5] stack: [108] locks: [93 / 84] rethrowException]
Other frame state: [locals: [1,2,183,184,317,318,319,319,319,319,5] stack: [320] locks: [321 / 294] rethrowException]
Parser context: androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2.invokeSuspend(Recomposer.kt:402) [bci: 167, intrinsic: false]
 167: invokestatic  #11         // androidx.compose.runtime.Recomposer.access$getHasFrameWorkLocked:(androidx.compose.runtime.Recomposer)boolean
 170: ifne          194
 173: aload         5
 175: invokestatic  #12         // androidx.compose.runtime.Recomposer.access$recordComposerModificationsLocked:(androidx.compose.runtime.Recomposer)void

Detailed message:
Call path from entry point to androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2.invokeSuspend(Object):
        at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2.invokeSuspend(Recomposer.kt)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
        at com.oracle.svm.core.jdk.RuntimeSupport.executeHooks(RuntimeSupport.java:125)
        at com.oracle.svm.core.jdk.RuntimeSupport.executeStartupHooks(RuntimeSupport.java:75)
        at com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:137)
        at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:182)
        at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)

        at com.oracle.svm.core.util.UserError.abort(UserError.java:82)
        at com.oracle.svm.hosted.FallbackFeature.reportAsFallback(FallbackFeature.java:233)
        at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:773)
        at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:563)
        at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:476)
        at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Frame states being merged are incompatible: unbalanced monitors - locked objects do not match
 This frame state: [locals: [1,2,67,57,80,82,83,83,83,83,5] stack: [108] locks: [93 / 84] rethrowException]
Other frame state: [locals: [1,2,183,184,317,318,319,319,319,319,5] stack: [320] locks: [321 / 294] rethrowException]
Parser context: androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2.invokeSuspend(Recomposer.kt:402) [bci: 167, intrinsic: false]
 167: invokestatic  #11         // androidx.compose.runtime.Recomposer.access$getHasFrameWorkLocked:(androidx.compose.runtime.Recomposer)boolean
 170: ifne          194
 173: aload         5
 175: invokestatic  #12         // androidx.compose.runtime.Recomposer.access$recordComposerModificationsLocked:(androidx.compose.runtime.Recomposer)void

Detailed message:
Call path from entry point to androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2.invokeSuspend(Object):
        at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2.invokeSuspend(Recomposer.kt)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
        at com.oracle.svm.core.jdk.RuntimeSupport.executeHooks(RuntimeSupport.java:125)
        at com.oracle.svm.core.jdk.RuntimeSupport.executeStartupHooks(RuntimeSupport.java:75)
        at com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:137)
        at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:182)
        at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)

        at com.oracle.graal.pointsto.constraints.UnsupportedFeatures.report(UnsupportedFeatures.java:126)
        at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:770)
        ... 8 more
Caused by: org.graalvm.compiler.core.common.PermanentBailoutException: Frame states being merged are incompatible: unbalanced monitors - locked objects do not match
 This frame state: [locals: [1,2,67,57,80,82,83,83,83,83,5] stack: [108] locks: [93 / 84] rethrowException]
Other frame state: [locals: [1,2,183,184,317,318,319,319,319,319,5] stack: [320] locks: [321 / 294] rethrowException]
Parser context: androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2.invokeSuspend(Recomposer.kt:402) [bci: 167, intrinsic: false]
 167: invokestatic  #11         // androidx.compose.runtime.Recomposer.access$getHasFrameWorkLocked:(androidx.compose.runtime.Recomposer)boolean
 170: ifne          194
 173: aload         5
 175: invokestatic  #12         // androidx.compose.runtime.Recomposer.access$recordComposerModificationsLocked:(androidx.compose.runtime.Recomposer)void

        at jdk.internal.vm.compiler/org.graalvm.compiler.java.FrameStateBuilder.checkCompatibleWith(FrameStateBuilder.java:419)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.FrameStateBuilder.merge(FrameStateBuilder.java:428)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.createTarget(BytecodeParser.java:3185)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.createTarget(BytecodeParser.java:3093)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.createHandleExceptionTarget(BytecodeParser.java:1360)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.handleException(BytecodeParser.java:1337)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.updateWithExceptionNode(BytecodeParser.java:2944)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.updateLastInstruction(BytecodeParser.java:2935)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.append(BytecodeParser.java:2919)
        at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext.add(GraphBuilderContext.java:116)
        at com.oracle.svm.hosted.phases.SubstrateClassInitializationPlugin.emitEnsureClassInitialized(SubstrateClassInitializationPlugin.java:79)
        at com.oracle.svm.hosted.phases.SubstrateClassInitializationPlugin.apply(SubstrateClassInitializationPlugin.java:64)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genInvokeStatic(BytecodeParser.java:1650)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genInvokeStatic(BytecodeParser.java:1634)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:5406)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3436)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:3243)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:1109)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:1003)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:84)
        at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase.run(SharedGraphBuilderPhase.java:76)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.run(Phase.java:49)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:212)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:42)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:38)
        at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:223)
        at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:357)
        at com.oracle.graal.pointsto.flow.MethodTypeFlow.doParse(MethodTypeFlow.java:313)
        at com.oracle.graal.pointsto.flow.MethodTypeFlow.ensureParsed(MethodTypeFlow.java:302)
        at com.oracle.graal.pointsto.flow.MethodTypeFlow.addContext(MethodTypeFlow.java:103)
        at com.oracle.graal.pointsto.DefaultAnalysisPolicy$DefaultSpecialInvokeTypeFlow.onObservedUpdate(DefaultAnalysisPolicy.java:368)
        at com.oracle.graal.pointsto.flow.TypeFlow$1.run(TypeFlow.java:433)
        at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$execute$0(CompletionExecutor.java:173)
        at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)
        ... 5 more
Error: Image build request failed with exit status 1

@munishchouhan munishchouhan self-assigned this Apr 16, 2021
@munishchouhan
Copy link
Contributor

@smallshen please provide reproducer

@smallshen
Copy link
Author

EridaniLauncher-windows-x64-1.0.0.jar.zip
It is built with kotlin 1.4.32, compose desktop version is v0.4.0-build183

@smallshen
Copy link
Author

I think the problem is the native compiler can not recognize the loop in kotlin coroutines. I tested with another jar made with jetpack compose it throws error of

Error: Non-reducible loop requires too much duplication
Call path from entry point to androidx.compose.foundation.gestures.TapGestureDetectorKt$detectTapGestures$2$1.invokeSuspend(Object):

@ScottPierce
Copy link

ScottPierce commented Apr 24, 2021

I'm also seeing this

@smallshen
Copy link
Author

any progress?

@munishchouhan
Copy link
Contributor

@smallshen I have raised this issue with our dev team, please wait for their response

@smallshen
Copy link
Author

#3358
I think this issue has same problem.

@davleopo davleopo self-assigned this May 11, 2021
@davleopo
Copy link
Member

Hi @smallshen , thanks for the report. Do you know if the problem reproduces on linux as well ? Having a linux reproducer would simplify the investigations.

@swarren-sumglobal
Copy link

I can confirm this problem exists on Linux, just can't commit to creating a reproducer at this time.

Detailed message:
Call path from entry point to com.osmose.osmolytics.simulation.initcond.service.SubmissionBatcher.waitforCompletion(Continuation): 
	at com.osmose.osmolytics.simulation.initcond.service.SubmissionBatcher.waitforCompletion(SubmissionBatcher.kt)
	at com.osmose.osmolytics.simulation.initcond.service.SubmissionBatcher.dequeue(SubmissionBatcher.kt:135)
	at com.osmose.osmolytics.simulation.initcond.service.BatchingServiceImpl$execute$2$deferred$1.invokeSuspend(BatchingService.kt:29)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
	at java.lang.Thread.run(Thread.java:834)
	at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:519)
	at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192)
	at com.oracle.svm.core.code.IsolateEnterStub.PosixJavaThreads_pthreadStartRoutine_e1f4a8c0039f8337338252cd8734f63a79b5e3df(generated:0)

	at com.oracle.svm.core.util.UserError.abort(UserError.java:82)
	at com.oracle.svm.hosted.FallbackFeature.reportAsFallback(FallbackFeature.java:233)
	at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:773)
	at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:563)
	at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:476)
	at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Frame states being merged are incompatible: unbalanced monitors - locked objects do not match
 This frame state: [locals: [332,2,70,81,83,314,240,#,_,_,33,296,_,448,449,450,451,452,453,33,33,33,_,_] stack: [454] locks: [455 / 422] rethrowException]
Other frame state: [locals: [857,2,70,81,83,858,1975,#,1976,1976,1977,1978,1979,1980,1977,1981,858,1982,1983,1977,1977,1977,1984,_] stack: [1985] locks: [1986 / 1936] rethrowException]
Parser context: com.osmose.osmolytics.simulation.initcond.service.SubmissionBatcher.waitforCompletion(SubmissionBatcher.kt:152) [bci: 550, intrinsic: false]
 550: getfield      #3          // queue:java.util.List
 553: aload         13
 555: invokeinterface#93, 2      // java.util.List.remove:(java.lang.Object)boolean
 560: pop           

@smallshen
Copy link
Author

@davleopo
JetpackComposeMinimumExample.zip
This is a small example with Jetpack Compose
use task "packageUberJarForCurrentOS" to create a fat jar.
The final jar file should be in build/compose/jars

@smallshen
Copy link
Author

Hi @smallshen , thanks for the report. Do you know if the problem reproduces on linux as well ? Having a linux reproducer would simplify the investigations.

Also it requires java 11+ to run

@davleopo
Copy link
Member

@smallshen thanks for the minimum example, I can reproduce the error locally, Ill dig in and get back to you once I have a fix/workaround.

@smallshen
Copy link
Author

I will do my best to provide you with the information if you need more

@smallshen
Copy link
Author

It should be the problem of kotlin coroutines, not only in jetpack compose, could be anywhere

@davleopo
Copy link
Member

@smallshen a fix for this went in some time ago. Can you still reproduce the issue?

@smallshen
Copy link
Author

It is solved, which leads to another problem in awt library loading

Cannot open (null)\bin\jawt.dll

@smallshen
Copy link
Author

Should I open a new issue?

@ScottPierce
Copy link

ScottPierce commented Sep 16, 2021 via email

@smallshen
Copy link
Author

Ok, new Issue link
#3807

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

No branches or pull requests

6 participants