You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[native-image] Error when compiling projects with Kotlin Coroutines #783
When compiling a Spring Fu application that is using Kotlin Coroutines 1.0.0, I get the following error while the same application with Reactive only API compiles correctly.
fatal error: com.oracle.svm.core.util.VMError$HostedError: Non-instantiated type referenced by a compiled method: kotlin.Result$Companion
at com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:66)
at com.oracle.svm.hosted.image.NativeImageCodeCache.addConstantToHeap(NativeImageCodeCache.java:366)
at com.oracle.svm.hosted.image.NativeImageCodeCache.addConstantsToHeap(NativeImageCodeCache.java:350)
at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:887)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:402)
at java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1386)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Error: Processing image build request failed
I'd love to show a minimized version of the issue:
// kotlin 1.3.11
suspend fun main() {
foo()
}
suspend fun foo() {}
Note that if you place Result.toString or Result.Companion.toString() (which is the same) at the beginning of the main function, then the error will be gone:
// kotlin 1.3.11
suspend fun main() {
Result.toString()
foo()
}
suspend fun foo() {}
There are several references to kotlin/Result$Failure in the generated bytecode, which doesn't seem illegal (at least from the first glance).
Maybe you could provide more information why this error appears? Could it be a bug in GraalVM?
Activity
sdeleuze commentedon Nov 7, 2018
Worth to notice:
kotlin.Resultis aninlineclass, a new feature from Kotlin 1.3, so the issue could maybe come from that. https://github.com/JetBrains/kotlin/blob/master/libraries/stdlib/coroutines/src/kotlin/Result.ktI created the following issue on Kotlin side: https://youtrack.jetbrains.com/issue/KT-28050
zarechenskiy commentedon Nov 16, 2018
I'd love to show a minimized version of the issue:
Note that if you place
Result.toStringorResult.Companion.toString()(which is the same) at the beginning of themainfunction, then the error will be gone:There are several references to
kotlin/Result$Failurein the generated bytecode, which doesn't seem illegal (at least from the first glance).Maybe you could provide more information why this error appears? Could it be a bug in GraalVM?
Disable OptClearNonLiveLocals for analysis parsing (#783).
[GR-13822] Disable OptClearNonLiveLocals for analysis parsing (#783).
cstancu commentedon Feb 11, 2019
@sdeleuze thanks for the report! @zarechenskiy thanks for the minimal reproducer! The issue is fixed in 57199de.