webrtc-java
webrtc-java copied to clipboard
OOM
system ubuntu1~20.04
JAVA_HOME OpenJDK 11
When I use webrtc video stream, the memory outside the Java heap keeps rising, and it will not be released after closing peerconnection. Until I use it for a period of time, the memory grows too much and is killed by the operating system.
my gc.log: [0.036s][info][gc] Using G1 [2.123s][info][gc] GC(0) Pause Young (Concurrent Start) (Metadata GC Threshold) 212M->13M(2048M) 22.814ms [2.123s][info][gc] GC(1) Concurrent Cycle [2.141s][info][gc] GC(1) Pause Remark 14M->14M(2048M) 3.210ms [2.143s][info][gc] GC(1) Pause Cleanup 15M->15M(2048M) 0.443ms [2.180s][info][gc] GC(1) Concurrent Cycle 56.335ms [4.330s][info][gc] GC(2) Pause Young (Concurrent Start) (Metadata GC Threshold) 170M->21M(2048M) 20.488ms [4.330s][info][gc] GC(3) Concurrent Cycle [4.368s][info][gc] GC(3) Pause Remark 22M->22M(2048M) 3.958ms [4.372s][info][gc] GC(3) Pause Cleanup 22M->22M(2048M) 0.333ms [4.407s][info][gc] GC(3) Concurrent Cycle 77.334ms [5.686s][info][gc] GC(4) Pause Young (Concurrent Start) (G1 Evacuation Pause) 515M->19M(2048M) 25.340ms [5.686s][info][gc] GC(5) Concurrent Cycle [5.705s][info][gc] GC(5) Pause Remark 26M->26M(2048M) 4.739ms [5.706s][info][gc] GC(5) Pause Cleanup 26M->26M(2048M) 0.314ms [5.713s][info][gc] GC(5) Concurrent Cycle 26.683ms [6.832s][info][gc] GC(6) Pause Young (Normal) (G1 Evacuation Pause) 512M->20M(2048M) 18.932ms [115.312s][info][gc] GC(7) Pause Young (Normal) (G1 Evacuation Pause) 1005M->20M(2048M) 33.977ms [499.246s][info][gc] GC(8) Pause Young (Normal) (G1 Evacuation Pause) 1119M->21M(2048M) 45.010ms
Heap memory is rarely used.
my /var/log/apport.log display: ERROR: apport (pid 2968167) Wed Dec 1 12:35:16 2021: called for pid 2964689, signal 6, core limit 0, dump mode 1 ERROR: apport (pid 2968167) Wed Dec 1 12:35:16 2021: executable: /usr/lib/jvm/java-11-openjdk-amd64/bin/java (command line "/usr/lib/jvm/java-11-openjdk-amd64/bin/java -Xms2048m -Xmx2048m -Xmn512m -XX:MaxDirectMemorySize=1g -XX:+UseG1GC -XX:+HeapDumpOnOutOfMemoryError -Xloggc:./logs/gc.log -XX:TieredStopAtLevel=1 -noverify -Dfile.encoding=UTF-8 -cp .:live.rtc-0.0.1-SNAPSHOT.jar:lib/* com.minivision.live.ActionRecApplication") ERROR: apport (pid 2968167) Wed Dec 1 12:35:16 2021: gdbus call error: Error: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
ERROR: apport (pid 2968167) Wed Dec 1 12:35:16 2021: debug: session gdbus call: ERROR: apport (pid 2968167) Wed Dec 1 12:37:18 2021: core dump exceeded 4457 MiB, dropped from /var/crash/_usr_lib_jvm_java-11-openjdk-amd64_bin_java.0.crash to avoid memory overflow ERROR: apport (pid 2968167) Wed Dec 1 12:37:18 2021: wrote report /var/crash/_usr_lib_jvm_java-11-openjdk-amd64_bin_java.0.crash
Getting the same issue. on jvm 17. From profiling, it seems like VideoFrame object are not garbage collected. The buffers are released, but the object count for VideoFrames and NativeI420Buffer keeps increasing and their age just keeps going up until OOM occurs
I think i fixed it in https://github.com/devopvoid/webrtc-java/pull/86