wasmer-java
wasmer-java copied to clipboard
JVM fails with core dump
Describe the bug
Invocation of a WASM binary triggers a segfault in the VM, crashing it. It seems that this occurs quite frequently on my laptop, but I'm seeing successful runs also.
An example of a failing run: https://scans.gradle.com/s/d7otkguc6enr6/console-log?anchor=73 Without any code change, this one passed: https://scans.gradle.com/s/cqx4p4rdmfdf2
Steps to reproduce
Pre-requisites: install cargo
and cargo install wasm-gc
.
- Clone https://github.com/melix/gradle-wasm-plugin
-
git chechout jvm-crash
- Run
./gradlew functionalTest
- See error (or not)
Expected behavior
The JVM shouldn't crash.
Actual behavior
The JVM crashes more often than it should.
Additional context
This behavior was observed under Linux Mint 20.1. I have attached a core dump.
The problem seems to occur during finalization. It's worth noting that you shouldn't rely on finalize
in Java.
Seems that commenting out the instance.close()
call on https://github.com/melix/gradle-wasm-plugin/blob/2ff26beb103c8049e7215084852d7dbbde889870/wasm-base-tasks/src/main/java/me/champeau/gradle/wasm/tasks/AbstractWasmTask.java#L49 fixes the pb.
Thank you for the detailed report! It looks a duplicated issue of https://github.com/wasmerio/wasmer-java/issues/58. I'll investigate :-).
I can confirm that not calling instance.close()
definitely improves stability. Calling it resulted in my JVM crashing without fail every time after a couple of invocations.