Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A deadlock occurred when I used multithread to exchange rtsp to rtmp. #1717

Closed
somnmos opened this issue Nov 4, 2021 · 3 comments
Closed

Comments

@somnmos
Copy link

somnmos commented Nov 4, 2021

################### Enviroments ###################
OS:

    CentOS Linux release 7.3.1611 (Core)

SRS:

    ossrs/srs:v3.0.156

JavaCV:

    <dependency>
        <groupId>org.bytedeco</groupId>
        <artifactId>javacv-platform</artifactId>
        <version>1.5.6</version>
    </dependency>

################################################

#################### Problems ####################

"pool-2-thread-10" #76 prio=5 os_prio=0 tid=0x00007f05a8052000 nid=0x1e3a waiting for monitor entry [0x00007f05c26a6000]
   java.lang.Thread.State: BLOCKED (on object monitor)
	at org.bytedeco.javacv.FFmpegFrameGrabber.start(FFmpegFrameGrabber.java:846)
	- waiting to lock <0x0000000080560d90> (a java.lang.Class for org.bytedeco.ffmpeg.global.avcodec)
	at org.bytedeco.javacv.FFmpegFrameGrabber.start(FFmpegFrameGrabber.java:841)
	at com.sugon.video.utils.Rtsp2RtmpTask.startGrabber(Rtsp2RtmpTask.java:70)
	at com.sugon.video.utils.Rtsp2RtmpTask.run(Rtsp2RtmpTask.java:42)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

   Locked ownable synchronizers:
	- <0x00000005cd400fd8> (a java.util.concurrent.ThreadPoolExecutor$Worker)

"pool-2-thread-9" #73 prio=5 os_prio=0 tid=0x00007f05b4084000 nid=0x19f2 waiting for monitor entry [0x00007f05c27a7000]
   java.lang.Thread.State: BLOCKED (on object monitor)
	at org.bytedeco.javacv.FFmpegFrameGrabber.start(FFmpegFrameGrabber.java:846)
	- waiting to lock <0x0000000080560d90> (a java.lang.Class for org.bytedeco.ffmpeg.global.avcodec)
	at org.bytedeco.javacv.FFmpegFrameGrabber.start(FFmpegFrameGrabber.java:841)
	at com.sugon.video.utils.Rtsp2RtmpTask.startGrabber(Rtsp2RtmpTask.java:70)
	at com.sugon.video.utils.Rtsp2RtmpTask.run(Rtsp2RtmpTask.java:42)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

   Locked ownable synchronizers:
	- <0x00000005cbbd5050> (a java.util.concurrent.ThreadPoolExecutor$Worker)

"pool-2-thread-8" #69 prio=5 os_prio=0 tid=0x00007f05b0038000 nid=0x949 waiting for monitor entry [0x00007f05c28a8000]
   java.lang.Thread.State: BLOCKED (on object monitor)
	at org.bytedeco.javacv.FFmpegFrameGrabber.start(FFmpegFrameGrabber.java:846)
	- waiting to lock <0x0000000080560d90> (a java.lang.Class for org.bytedeco.ffmpeg.global.avcodec)
	at org.bytedeco.javacv.FFmpegFrameGrabber.start(FFmpegFrameGrabber.java:841)
	at com.sugon.video.utils.Rtsp2RtmpTask.startGrabber(Rtsp2RtmpTask.java:70)
	at com.sugon.video.utils.Rtsp2RtmpTask.run(Rtsp2RtmpTask.java:42)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

   Locked ownable synchronizers:
	- <0x00000005c92ae2c0> (a java.util.concurrent.ThreadPoolExecutor$Worker)

"pool-2-thread-7" #67 prio=5 os_prio=0 tid=0x00007f05b4025000 nid=0x7d9 runnable [0x00007f05c29a9000]
   java.lang.Thread.State: RUNNABLE
	at org.bytedeco.ffmpeg.global.avformat.avformat_find_stream_info(Native Method)
	at org.bytedeco.javacv.FFmpegFrameGrabber.startUnsafe(FFmpegFrameGrabber.java:928)
	- locked <0x00000005c883bec8> (a org.bytedeco.javacv.FFmpegFrameGrabber)
	at org.bytedeco.javacv.FFmpegFrameGrabber.start(FFmpegFrameGrabber.java:846)
	- locked <0x0000000080560d90> (a java.lang.Class for org.bytedeco.ffmpeg.global.avcodec)
	at org.bytedeco.javacv.FFmpegFrameGrabber.start(FFmpegFrameGrabber.java:841)
	at com.sugon.video.utils.Rtsp2RtmpTask.startGrabber(Rtsp2RtmpTask.java:70)
	at com.sugon.video.utils.Rtsp2RtmpTask.run(Rtsp2RtmpTask.java:42)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

   Locked ownable synchronizers:
	- <0x00000005c8795320> (a java.util.concurrent.ThreadPoolExecutor$Worker)

################################################

@somnmos somnmos changed the title A deadlock occurred when I used multithread to exchange rtsp to rtmp。 A deadlock occurred when I used multithread to exchange rtsp to rtmp. Nov 4, 2021
@somnmos
Copy link
Author

somnmos commented Nov 4, 2021

image

can anybody help me.

@saudet
Copy link
Member

saudet commented Nov 4, 2021

Call startUnsafe() instead of start().

@saudet
Copy link
Member

saudet commented Nov 4, 2021

Duplicate of #1139

@saudet saudet marked this as a duplicate of #1139 Nov 4, 2021
@saudet saudet closed this as completed Nov 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants