Javet icon indicating copy to clipboard operation
Javet copied to clipboard

createV8Runtime crash

Open huangjunAAAA opened this issue 8 months ago • 1 comments

In Ubuntu I encounter the problem when two threads create v8runtimes, the VM crashes. This problem is not found in Windows however. Here is the code for bug reproduction, attached file is jvm crash report:

public class UnifiedEntityRTApplication {

private static final IJavetEnginePool<V8Runtime> javetEnginePool = new JavetEnginePool<>();

public static void main(String[] args) throws Exception {
    new Thread(() -> {
        try {
            test2();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }).start();

    new Thread(() -> {
        try {
            test2();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }).start();

}

private static void test2() throws Exception {
    try (IJavetEngine<V8Runtime> javetEngine = javetEnginePool.getEngine()) {
        V8Runtime v8Runtime = javetEngine.getV8Runtime();
    }
}

}

Java version: openjdk version "1.8.0_442" OpenJDK Runtime Environment (build 1.8.0_442-8u442-b06~us1-0ubuntu1~22.04-b06) OpenJDK 64-Bit Server VM (build 25.442-b06, mixed mode)

Ubuntu version: Distributor ID: Ubuntu Description: Ubuntu 22.04.5 LTS Release: 22.04 Codename: jammy

hs_err_pid728297.log

huangjunAAAA avatar Apr 22 '25 03:04 huangjunAAAA

Please check this doc out.

caoccao avatar Apr 22 '25 06:04 caoccao