eclipsesource / eclipsesource/J2V8

Memory leak

Open
#476 13 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

We have an application that brings up several short lived J2V8 engines a second and over a couple of days, the java process consumes more and more memory until the server becomes unresponsive. Restarting the Java process fixes the issue and frees the memory.
We have monitored the heap, which looks fine, so believe there is a memory leak in either the JNI layer or the V8 instances themselves.
The leak can be easily demonstrated with the following code:

```java
public static void main(String[] args) {
while(true) {
try (V8 v8 = V8.createV8Runtime()) {}
}
}
```

During a run of the test I dumped the memory stats periodically.

##### The first memory stats just after Java launch:
Thu Sep 12 09:14:39 UTC 2019
```
total used free shared buff/cache available
Mem: 2002820 797368 515472 5344 689980 1045256
```

##### The last memory stats before the server became unresponsive:
Thu Sep 12 11:34:21 UTC 2019
```
total used free shared buff/cache available
Mem: 2002820 1898052 64968 5148 39800 7040
```

##### The memory stats after killing the Java process:
```
total used free shared buff/cache available
Mem: 2002820 834248 923900 5212 244672 1019236
```

Here are some details on the server OS and software:

#### OS Details
NAME="Ubuntu"
VERSION="18.04.2 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.2 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

#### J2V8 Build Output
J2V8 Version
[INFO] --------------< com.eclipsesource.j2v8:j2v8_linux_x86_64 >--------------
[INFO] Building j2v8_linux_x86_64 5.1.0-SNAPSHOT

#### V8 Details
Version 5.4.500

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.