graal
graal copied to clipboard
[GR-32914] Kotlin 1.5.10 and nativeImage gradle builds fail
Describe the issue
Kotlin 1.5.21 and nativeImage gradle builds fail
Steps to reproduce the issue
See https://github.com/square/okhttp/runs/2816094342?check_suite_focus=true
[ConsoleLauncher:1931] (features): 2,117.94 ms, 2.82 GB
Error: Unsupported features in 5 methods
[ConsoleLauncher:1931] analysis: 97,213.36 ms, 2.82 GB
Detailed message:
Error: unbalanced monitors: mismatch at monitorexit, 106|LoadField#this$0 != 162|LoadField#this$0
Call path from entry point to okhttp3.internal.http2.Http2Connection$pushHeadersLater$$inlined$execute$default$1.runOnce():
at okhttp3.internal.http2.Http2Connection$pushHeadersLater$$inlined$execute$default$1.runOnce(TaskQueue.kt:98)
at okhttp3.internal.concurrent.TaskRunner.runTask(TaskRunner.kt:116)
at okhttp3.internal.concurrent.TaskRunner.access$runTask(TaskRunner.kt:42)
at okhttp3.internal.concurrent.TaskRunner$runnable$1.run(TaskRunner.kt:65)
at java.lang.Thread.run(Thread.java:829)
at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:553)
at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192)
at com.oracle.svm.core.code.IsolateEnterStub.PosixJavaThreads_pthreadStartRoutine_e1f4a8c0039f8337338252cd8734f63a79b5e3df(generated:0)
Original exception that caused the problem: org.graalvm.compiler.code.SourceStackTraceBailoutException$1: unbalanced monitors: mismatch at monitorexit, 106|LoadField#this$0 != 162|LoadField#this$0
at okhttp3.internal.http2.Http2Connection$pushHeadersLater$$inlined$execute$default$1.runOnce(TaskQueue.kt:225)
Caused by: org.graalvm.compiler.core.common.PermanentBailoutException: unbalanced monitors: mismatch at monitorexit, 106|LoadField#this$0 != 162|LoadField#this$0
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.bailout(BytecodeParser.java:3974)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genMonitorExit(BytecodeParser.java:2842)
Please include both build steps as well as run steps
- git clone https://github.com/square/okhttp
- git checkout bff87d1fc6bf1527a4052b0b5251fab53238f714
- ./gradlew okcurl:nativeImage or
- ./gradlew -PgraalBuild native-image-tests:nativeImage
Describe GraalVM and your environment:
- GraalVM version: 21.2.0 (or 21.0.x)
- JDK major version: 11
@yschimke thanks for reporting the issue We will check it out and get back to you
@yschimke Apologies for replying so late, but when I tried to check out the branch in the reproducer, I am getting the following error: git checkout 7842d7da9f89d99b85f6a539a146b678c7558417 fatal: reference is not a tree: 7842d7da9f89d99b85f6a539a146b678c7558417
Hi @yschimke any update on this?
@mcraj017 my bad, I had pushed my commit to my fork, not the square org repo. I've updated the PR (SHA bff87d1fc6bf1527a4052b0b5251fab53238f714) and pushed to square org. Should work now.
https://github.com/square/okhttp/pull/6777
This workaround fixes it
--- a/okhttp/src/main/kotlin/okhttp3/internal/concurrent/TaskQueue.kt
+++ b/okhttp/src/main/kotlin/okhttp3/internal/concurrent/TaskQueue.kt
@@ -76,22 +76,24 @@ class TaskQueue internal constructor(
}
/** Overload of [schedule] that uses a lambda for a repeating task. */
- inline fun schedule(
+ fun schedule(
name: String,
delayNanos: Long = 0L,
- crossinline block: () -> Long
+ block: () -> Long
) {
schedule(object : Task(name) {
- override fun runOnce() = block()
+ override fun runOnce(): Long {
+ return block()
+ }
}, delayNanos)
}
/** Executes [block] once on a task runner thread. */
- inline fun execute(
+ fun execute(
name: String,
delayNanos: Long = 0L,
cancelable: Boolean = true,
- crossinline block: () -> Unit
+ block: () -> Unit
) {
schedule(object : Task(name, cancelable) {
override fun runOnce(): Long {
@yschimke thanks for that, i will check it out and let you know
@yschimke I have raised the bug to native-image team
Updates?
Updates?