eclipsesource / eclipsesource/J2V8

Using multiple NodeJS instances in different threads often end in jvm crash

Open
#351 18 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.6k
Forks
387
PR merge metrics
No merged PRs in 30d

Description

When I use multiple instances of com.eclipsesource.v8.NodeJS in different threads (one instance per thread, no concurrent access) the JVM becomes pretty unstable and often crashes

Executing the following code snipped in 3 threads in parallel crashes the JVM with a chance of about 30%:

```
private static class JSRunnable implements Runnable {
public void run() {
final NodeJS nodeJS = NodeJS.createNodeJS();
V8 v8 = nodeJS.getRuntime();
V8Object esprima = nodeJS.require(new File(""));
V8Object result = (V8Object) esprima.executeJSFunction("nonexistingFunction", "answer = 42");
System.out.println(result);
result.release();
nodeJS.release();
}}
```

A fatal error has been detected by the Java Runtime Environment: Internal Error ...

Observed in version com.eclipsesource.j2v8:j2v8_win32_x86_64:4.6.0
Using Oracle JVM 64 bit: Java(TM) SE Runtime Environment (build 1.8.0_144-b01)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.