bytedeco / javacv

Java interface to OpenCV, FFmpeg, and more
Other
7.57k stars 1.58k forks source link

Using Java2DFrameConverter causes JVM crashes #2266

Open lbz303 opened 3 months ago

lbz303 commented 3 months ago

Currently, I am experiencing intermittent JVM crashes when using JavaCV to capture the first frame. I found similar issues reported in the issue tracker, with a suggestion to use PointerScope to resolve the problem. Despite adding the recommended code, the issue persists. Could you please advise on what might still be causing the problem?

log.info("5-----------"); if (frame.image == null) { VideoHttpResult.ERROR_VIDEO_NO_PICTURE_EXISTS.appBizException(); } log.info("6-----------"); BufferedImage image = null; try(PointerScope pointerScope = new PointerScope()){ Java2DFrameConverter converter = new Java2DFrameConverter(); log.info("6.11111-----------"); image = converter.convert(frame); } log.info("7-----------");

08-07 15:11:51.643 [INFO ] [com.wxy.video.server.util.FFVideoUtil :232 ] [http-nio-8818-exec-20 ] - 4----------- 08-07 15:11:51.644 [INFO ] [com.wxy.video.server.util.FFVideoUtil :236 ] [http-nio-8818-exec-20 ] - 5----------- 08-07 15:11:51.644 [INFO ] [com.wxy.video.server.util.FFVideoUtil :240 ] [http-nio-8818-exec-20 ] - 6----------- 08-07 15:11:51.644 [INFO ] [com.wxy.video.server.util.FFVideoUtil :245 ] [http-nio-8818-exec-20 ] - 6.11111----------- #

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

#

SIGSEGV (0xb) at pc=0x00007f681553bb65, pid=11, tid=188

#

JRE version: Java(TM) SE Runtime Environment (11.0.1+13) (build 11.0.1+13-LTS)

Java VM: Java HotSpot(TM) 64-Bit Server VM (11.0.1+13-LTS, mixed mode, tiered, compressed oops, g1 gc, linux-amd64)

Problematic frame:

J 22035 c2 org.bytedeco.javacv.Java2DFrameConverter.flipCopyWithGamma(Ljava/nio/ByteBuffer;IILjava/nio/ByteBuffer;IIZDZI)V (635 bytes) @ 0x00007f681553bb65 [0x00007f681553b7e0+0x0000000000000385]

#

Core dump will be written. Default location: /app/wxy-video-server/core.11

#

An error report file with more information is saved as:

/app/wxy-video-server/hs_err_pid11.log

Could not load hsdis-amd64.so; library not loadable; PrintAssembly is disabled #

If you would like to submit a bug report, please visit:

http://bugreport.java.com/bugreport/crash.jsp

# Aborted (core dumped) /app/wxy-video-server/docker-start.sh: 17: [[: not found Running in docker!

saudet commented 3 months ago

Please try to set the "org.bytedeco.javacpp.nopointergc" system property to "true".