bytedeco / javacv

Java interface to OpenCV, FFmpeg, and more
Other
7.44k stars 1.57k forks source link

A jvm crash occurs after FFmpegFrameGrabber is used in docker #1944

Closed mdzz0073 closed 1 year ago

mdzz0073 commented 1 year ago

When I used FFmpegFrameGrabber normally to get video file information, I was fine, but when I containerized the service, using FFmpegFrameGrabber caused a jvm crash

source code: public static String getVideoFps(File file){ log.info("打开ffmpeg"); FFmpegFrameGrabber grabber = new FFmpegFrameGrabber(file); String result = ""; try { grabber.start(); Integer frameRate = (int) grabber.getVideoFrameRate(); result = String.valueOf(frameRate); grabber.stop(); }catch (Exception e){ } return result; }

jvm crash when grabber.start();

this is error: #

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

#

SIGSEGV (0xb) at pc=0x000000000000dc56, pid=14, tid=0x00007f8218d22b38

#

JRE version: OpenJDK Runtime Environment (8.0_302-b08) (build 1.8.0_302-b08)

Java VM: OpenJDK 64-Bit Server VM (25.302-b08 mixed mode linux-amd64 compressed oops)

Derivative: IcedTea 3.20.0

Distribution: Custom build (Wed Oct 20 22:15:10 UTC 2021)

Problematic frame:

C 0x000000000000dc56

#

Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again

#

An error report file with more information is saved as:

java_error_9006.log

#

If you would like to submit a bug report, please include

instructions on how to reproduce the bug and visit:

https://icedtea.classpath.org/bugzilla

saudet commented 1 year ago

It looks like you're trying to use Alpine, in which case you'll need to use a version of OpenJDK that uses glibc.

mdzz0073 commented 1 year ago

i try use openjdk1.8.0_345, but it didn't work。Whether I need to install glibc

saudet commented 1 year ago

To make this work, instead of using Alpine, you could also use CentOS or Ubuntu

mdzz0073 commented 1 year ago

But I still had a jvm crash after installing glibc.

This is my error log:

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

#

SIGSEGV (0xb) at pc=0x0000000000011466, pid=14, tid=0x00007f2e7097fb38

#

JRE version: OpenJDK Runtime Environment (8.0_345-b01) (build 1.8.0_345-b01)

Java VM: OpenJDK 64-Bit Server VM (25.345-b01 mixed mode linux-amd64 compressed oops)

Derivative: IcedTea 3.24.0

Distribution: Custom build (Tue Aug 23 09:53:14 UTC 2022)

Problematic frame:

C 0x0000000000011466

#

Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again

#

An error report file with more information is saved as:

/tmp/hs_err_pid14.log

#

If you would like to submit a bug report, please include

instructions on how to reproduce the bug and visit:

https://icedtea.classpath.org/bugzilla

saudet commented 1 year ago

If you absolutely need to use that version of OpenJDK, you'll need to rebuild from source without glibc: https://github.com/bytedeco/javacpp-presets/#build-instructions

mdzz0073 commented 1 year ago

Can you tell me what version of opendjdk I should use

saudet commented 1 year ago

Any of the ones mentioned in the README.md file: https://github.com/bytedeco/javacv#required-software

saudet commented 1 year ago

Duplicate of https://github.com/bytedeco/javacpp/issues/329