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

Fix disconnect RTSP connection has assertion, resulting in program exit #1612

Merged
merged 1 commit into from
Mar 7, 2020

Conversation

xialixin
Copy link
Contributor

@xialixin xialixin commented Feb 17, 2020

After the RTSP connection is disconnected, an assertion error occurs when releasing the RTSP connection, causing the program to exit.
[2020-02-17 18:00:54.353][Trace][8480][897] rtsp: ignore header User-Agent=Lavf57.56.101
srs: src/app/srs_app_st.cpp:146: virtual void SrsSTCoroutine::stop(): Assertion `!r0' failed.
Aborted
[root@iZ8vbd93czg2ytwfhy1fmnZ trunk]#


TRANS_BY_GPT3

@@ -179,6 +179,7 @@ SrsRtspListener::SrsRtspListener(SrsServer* svr, SrsListenerType t, SrsConfDirec
srs_assert(type == SrsListenerRtsp);
if (type == SrsListenerRtsp) {
caster = new SrsRtspCaster(c);
caster->initialize();
Copy link
Member

@winlinvip winlinvip Mar 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

initialize has a return value, so it should be checked.
Currently, it may not return an error, but someone may modify the implementation of this function in the future without necessarily modifying the corresponding check.
This could potentially lead to unexpected behavior, where errors are present but the program continues to run.

TRANS_BY_GPT3

Copy link
Member

@winlinvip winlinvip Mar 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added TODO.

TRANS_BY_GPT3

@winlinvip winlinvip changed the base branch from develop to 4.0release March 7, 2020 14:31
@winlinvip winlinvip merged commit 12a7432 into ossrs:4.0release Mar 7, 2020
winlinvip added a commit that referenced this pull request Mar 7, 2020
srs_error_t err = srs_success;
if ((err = manager->start()) != srs_success) {
return srs_error_wrap(err, "start manager");
}
Copy link
Member

@winlinvip winlinvip Mar 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function should return an error, otherwise there may be unknown behavior. It has already been fixed.

TRANS_BY_GPT3

Copy link
Contributor Author

@xialixin xialixin Mar 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

En, you still consider everything comprehensively ^_^

TRANS_BY_GPT3

@franzwarning
Copy link

franzwarning commented Apr 11, 2020

I'm on the latest version of srs (4.0release)

➜  trunk git:(4.0release) ✗ ./objs/srs -V' translates to '➜  trunk git:(4.0release) ✗ ./objs/srs -V' in English.
4.0.22

And I'm getting this crash of srs:

srs: src/app/srs_app_st.cpp:146: virtual void SrsSTCoroutine::stop(): Assertion `!r0' failed.

Here are the logs around the error:

[2020-04-11 00:38:39.381][Trace][1794][789] http: on_unpublish ok, client_id=789, url=xxxx, request={"action":"on_unpublish","client_id":789,"ip":"xxxxxxxx","vhost":"xxxxx","app":"live","stream":"aimeneveu","param":"?token=speedy-husky"}, response=0
[2020-04-11 00:38:39.381][Error][1794][789][11] serve error code=1028 : service cycle : rtmp: stream service : rtmp: stream xxxxx/live/aimeneveu is busy
thread [1794][789]: do_cycle() [src/app/srs_app_rtmp_conn.cpp:210][errno=11]
thread [1794][789]: service_cycle() [src/app/srs_app_rtmp_conn.cpp:399][errno=11]
thread [1794][789]: acquire_publish() [src/app/srs_app_rtmp_conn.cpp:931][errno=11](Resource temporarily unavailable)
[2020-04-11 00:38:39.400][Trace][1794][765] SIGKILL stop process pid=2384 ok.
[2020-04-11 00:38:39.400][Trace][1794][765] send SIGTERM to pid=2385
[2020-04-11 00:38:39.401][Warn][1794][766][11] client disconnect peer. ret=1007
[2020-04-11 00:38:39.401][Trace][1794][771] cleanup when unpublish
[2020-04-11 00:38:39.455][Trace][1794][771] http: on_unpublish ok, client_id=771, url=xxxxxx, request={"action":"on_unpublish","client_id":771,"ip":"127.0.0.1","vhost":"xxxxxxxxx","app":"live","stream":"aimeneveu_audio_only","param":"?vhost=xxxxxxx"}, response=0
[2020-04-11 00:38:39.455][Warn][1794][771][11] client disconnect peer. ret=1007
[2020-04-11 00:38:39.547][Trace][1794][790] API server client, ip=xxxxx
[2020-04-11 00:38:39.547][Trace][1794][790] HTTP API GET xxxxxx/api/v1/streams/, content-length=-1, chunked=0/0
[2020-04-11 00:38:39.547][Trace][1794][790] client finished.
srs: src/app/srs_app_st.cpp:146: virtual void SrsSTCoroutine::stop(): Assertion `!r0' failed.
[2020-04-11 00:38:39.585][Trace][1794][791] API server client, ip=xxxxxxx
[2020-04-11 00:38:39.585][Trace][1794][791] HTTP API DELETE http://xxxxxxx/api/v1/clients/765/, content-length=0, chunked=0/0
[2020-04-11 00:38:39.585][Warn][1794][791][11] kickoff client id=765 ok
[2020-04-11 00:38:39.586][Trace][1794][791] client finished.

One thing I have noticed, is that the crash always happens after a "stream is busy" message. Perhaps that has something to do with it?

It seems like i'm connected on the same IP with two different clients?

TRANS_BY_GPT3

@ChvFily
Copy link

ChvFily commented Apr 12, 2021

`
Operation process: ffmpeg streaming

ffmpeg -re -i class.mp4 -vcodec copy -codec copy -f rtsp rtsp://210.37.1.20:554/live/rtsp

SRS opens the RTSP switch.

SRS prints logs.

[2021-04-12 16:05:02.273][Trace][31688][9o5713ef] rtsp: serve 10.130.7.75:59224
[2021-04-12 16:05:02.274][Trace][31688][9o5713ef] rtsp: ignore header User-Agent=Lavf58.41.100
[2021-04-12 16:05:02.280][Trace][31688][9o5713ef] rtsp: ignore header User-Agent=Lavf58.41.100
[2021-04-12 16:05:02.323][Trace][31688][9o5713ef] rtsp: video(#0, H264, RTP/AVP/96), audio(#1, MPEG4-GENERIC, RTP/AVP/97, 44100HZ 2channels), rtsp://210.37.1.20:554/live/rtsp
[2021-04-12 16:05:02.326][Trace][31688][9o5713ef] rtsp: ignore header User-Agent=Lavf58.41.100
[2021-04-12 16:05:02.326][Trace][31688][9o5713ef] rtsp: rtsp alloc port=57200-57201
[2021-04-12 16:05:02.326][Trace][31688][9o5713ef] UDP #14 LISTEN at 0.0.0.0:57200, SO_SNDBUF(default=212992, expect=10485760, actual=425984, r0=0), SO_RCVBUF(default=212992, expect=10485760, actual=425984, r0=0)
[2021-04-12 16:05:02.326][Trace][31688][9o5713ef] rtsp: #0 Video over RTP/AVP/UDP unicast client-port=11768-11769, server-port=57200-57201
[2021-04-12 16:05:02.328][Trace][31688][9o5713ef] rtsp: ignore header User-Agent=Lavf58.41.100
[2021-04-12 16:05:02.328][Trace][31688][9o5713ef] rtsp: rtsp alloc port=57202-57203
[2021-04-12 16:05:02.328][Trace][31688][9o5713ef] UDP #15 LISTEN at 0.0.0.0:57202, SO_SNDBUF(default=212992, expect=10485760, actual=425984, r0=0), SO_RCVBUF(default=212992, expect=10485760, actual=425984, r0=0)
[2021-04-12 16:05:02.328][Trace][31688][9o5713ef] rtsp: #1 Audio over RTP/AVP/UDP unicast client-port=11770-11771, server-port=57202-57203
[2021-04-12 16:05:02.330][Trace][31688][9o5713ef] rtsp: ignore header Range=npt=0.000-
[2021-04-12 16:05:02.330][Trace][31688][9o5713ef] rtsp: ignore header User-Agent=Lavf58.41.100
[2021-04-12 16:05:02.341][Trace][31688][385u5269] -> IGS time=24017ms, ingesters=1, #0(alive=24017ms, defaultVhost/livestream)
[2021-04-12 16:05:02.346][Trace][31688][7l48753z] RTMP client ip=127.0.0.1:40986, fd=17
[2021-04-12 16:05:02.351][Trace][31688][9o5713ef] complex handshake success.
[2021-04-12 16:05:02.351][Trace][31688][9o5713ef] protocol in.buffer=0, in.ack=0, out.ack=0, in.chunk=128, out.chunk=128
[2021-04-12 16:05:02.351][Trace][31688][7l48753z] complex handshake success
[2021-04-12 16:05:02.398][Trace][31688][7l48753z] connect app, tcUrl=rtmp://127.0.0.1/live, pageUrl=, swfUrl=, schema=rtmp, vhost=127.0.0.1, port=1935, app=live, args=(obj)
[2021-04-12 16:05:02.398][Trace][31688][7l48753z] edge-srs ip=210.37.1.20, version=4.0.81, pid=31688, id=0
[2021-04-12 16:05:02.398][Trace][31688][7l48753z] protocol in.buffer=0, in.ack=0, out.ack=0, in.chunk=128, out.chunk=128
[2021-04-12 16:05:02.399][Trace][31688][7l48753z] ignore message type=0x8
[2021-04-12 16:05:02.399][Trace][31688][7l48753z] ignore message type=0x8
[2021-04-12 16:05:02.399][Trace][31688][7l48753z] ignore message type=0x8
[2021-04-12 16:05:02.442][Trace][31688][9o5713ef] connected, version=4.0.81.0, ip=127.0.0.1, pid=31688, id=0, dsu=1
[2021-04-12 16:05:02.445][Trace][31688][7l48753z] client identified, type=flash-publish, vhost=127.0.0.1, app=live, stream=rtsp, param=?vhost=127.0.0.1, duration=0ms
[2021-04-12 16:05:02.445][Trace][31688][7l48753z] connected stream, tcUrl=rtmp://127.0.0.1/live, pageUrl=, swfUrl=, schema=rtmp, vhost=defaultVhost, port=1935, app=live, stream=rtsp, param=?vhost=127.0.0.1, args=(obj)
[2021-04-12 16:05:02.445][Trace][31688][7l48753z] new source, stream_url=/live/rtsp
[2021-04-12 16:05:02.445][Trace][31688][7l48753z] source url=/live/rtsp, ip=127.0.0.1, cache=1, is_edge=0, source_id=/
[2021-04-12 16:05:02.446][Trace][31688][7l48753z] hls: win=60000ms, frag=10000ms, prefix=, path=./objs/nginx/html, m3u8=[app]/[stream].m3u8, ts=[app]/[stream]-[seq].ts, aof=2.00, floor=0, clean=1, waitk=1, dispose=0ms, dts_directly=1
[2021-04-12 16:05:02.446][Trace][31688][7l48753z] ignore disabled exec for vhost=defaultVhost
[2021-04-12 16:05:02.446][Trace][31688][7l48753z] http: mount flv stream for sid=/live/rtsp, mount=/live/rtsp.flv
[2021-04-12 16:05:02.446][Trace][31688][7l48753z] start publish mr=0/350, p1stpt=20000, pnt=5000, tcp_nodelay=0
[2021-04-12 16:05:02.446][Trace][31688][7l48753z] 42B video sh, codec(7, profile=Baseline, level=3, 1280x720, 0kbps, 0.0fps, 0.0s)
[2021-04-12 16:05:02.447][Trace][31688][7l48753z] 7B audio sh, codec(10, profile=LC, 2channels, 0kbps, 44100HZ), flv(16bits, 2channels, 44100HZ)
[2021-04-12 16:05:02.485][Warn][31688][7l48753z][11] AUDIO: stream not monotonically increase, please open mix_correct.
[2021-04-12 16:05:03.776][Trace][31688][385u5269] Hybrid cpu=1.67%,15MB, cid=1,0, timer=51,0,0, clock=0,43,5,1,0,0,0,0,0, objs=(pkt:0,raw:0,fua:0,msg:226,oth:0,buf:0,drop:0)
[2021-04-12 16:05:08.911][Trace][31688][385u5269] Hybrid cpu=6.00%,16MB, cid=6,1, timer=52,0,0, clock=0,43,4,1,0,0,0,0,0, objs=(pkt:0,raw:0,fua:0,msg:554,oth:0,buf:0,drop:0)
[2021-04-12 16:05:11.618][Trace][31688][m79m3822] <- CPB time=25000682, okbps=1,1,0, ikbps=749,749,0, mr=0/350, p1stpt=20000, pnt=5000
[2021-04-12 16:05:12.116][Trace][31688][m79m3822] -> HLS time=30601907ms, sno=3, ts=livestream-2.ts, dur=0.00, dva=7633p
[2021-04-12 16:05:12.382][Trace][31688][9o5713ef] <- SCS rtsp: rtp #1 1134B, age=10041763, vt=2/97, sts=3109/1082036700/0x6aeac20f, paylod=1114B, chunked=0
[2021-04-12 16:05:14.072][Trace][31688][385u5269] Hybrid cpu=4.33%,16MB, cid=6,1, timer=52,0,0, clock=0,43,4,1,0,0,0,0,0, objs=(pkt:0,raw:0,fua:0,msg:554,oth:0,buf:0,drop:0)
[2021-04-12 16:05:14.342][Trace][31688][385u5269] -> IGS time=36022ms, ingesters=1, #0(alive=36022ms, defaultVhost/livestream)
`

TRANS_BY_GPT3

@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TransByAI Translated by AI/GPT.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants