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

Publish crash when dvr forward enabled and dvr_path file exists #3901

Closed
ysc3839 opened this issue Dec 5, 2023 · 1 comment · Fixed by #3914
Closed

Publish crash when dvr forward enabled and dvr_path file exists #3901

ysc3839 opened this issue Dec 5, 2023 · 1 comment · Fixed by #3914
Labels
Bug It might be a bug. EnglishNative This issue is conveyed exclusively in English. good first issue Easy to fix issues, good for newcomers help wanted Extra attention is needed

Comments

@ysc3839
Copy link

ysc3839 commented Dec 5, 2023

Describe the bug
When dvr forward enabled in a vhost, and the file specified by dvr_path exists, publish to this vhost cause SRS crash.

Version
v6.0-d3

To Reproduce
Steps to reproduce the behavior:

  1. Use config file below.
  2. Execute command:
touch stream1.flv
./srs -c srs.conf
  1. Publish stream to rtmp://127.0.0.1:8800/app/stream1:
    ffmpeg -f lavfi -i testsrc -c:v h264 -f flv 'rtmp://127.0.0.1:8800/app/stream1'
  2. SRS crash.

Expected behavior
No crash.

Screenshots
N/A

Additional context
config file:

listen 8800;
pid ./srs.pid;
srs_log_tank file;
srs_log_level_v2 trace;
srs_log_file ./srs.log;
daemon off;

vhost __defaultVhost__ {
	dvr {
		enabled on;
		dvr_path ./[stream].flv;
	}
	forward 127.0.0.1:60000;
}

gdb backtrace:

#0  0x0000000000792c8b in SrsForwarder::on_unpublish (this=0x7f6aac040af0) at ./src/app/srs_app_forward.cpp:97
#1  0x000000000077e5a4 in SrsOriginHub::destroy_forwarders (this=0x7f6aac04d600) at ./src/app/srs_app_source.cpp:1559
#2  0x000000000077c875 in SrsOriginHub::on_unpublish (this=0x7f6aac04d600) at ./src/app/srs_app_source.cpp:1162
#3  0x00000000007835e2 in SrsLiveSource::on_unpublish (this=0x7f6aac04da60) at ./src/app/srs_app_source.cpp:2629
#4  0x00000000007752c9 in SrsRtmpConn::release_publish (this=0x7f6aac042f90, source=0x7f6aac04da60)
    at ./src/app/srs_app_rtmp_conn.cpp:1146
#5  0x0000000000773ae9 in SrsRtmpConn::publishing (this=0x7f6aac042f90, source=0x7f6aac04da60)
    at ./src/app/srs_app_rtmp_conn.cpp:964
#6  0x0000000000770bce in SrsRtmpConn::stream_service_cycle (this=0x7f6aac042f90)
    at ./src/app/srs_app_rtmp_conn.cpp:630
#7  0x000000000076f383 in SrsRtmpConn::service_cycle (this=0x7f6aac042f90) at ./src/app/srs_app_rtmp_conn.cpp:446
#8  0x000000000076e254 in SrsRtmpConn::do_cycle (this=0x7f6aac042f90) at ./src/app/srs_app_rtmp_conn.cpp:262
#9  0x0000000000777620 in SrsRtmpConn::cycle (this=0x7f6aac042f90) at ./src/app/srs_app_rtmp_conn.cpp:1604
#10 0x000000000079f739 in SrsFastCoroutine::cycle (this=0x7f6aac043190) at ./src/app/srs_app_st.cpp:285
#11 0x000000000079f7bc in SrsFastCoroutine::pfn (arg=0x7f6aac043190) at ./src/app/srs_app_st.cpp:300
#12 0x000000000090c8af in _st_thread_main () at sched.c:380
#13 0x000000000090d19e in st_thread_create (start=0x7f6ab4008e58, arg=0xb28b3700, joinable=32618, stk_size=-1408971248)
    at sched.c:666
#14 0x0000000000742ab6 in srs_context_set_cid_of (trd=0x7f6ab4008e58, v=...) at ./src/protocol/srs_protocol_log.cpp:91
#15 0x000000000067f75f in _SrsContextId::~_SrsContextId (this=0x7f6ab4008b78, __in_chrg=<optimized out>)
    at ./src/core/srs_core.cpp:24
#16 0x00007f6ab36ebe23 in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() ()
   from /lib64/libstdc++.so.6
#17 0x000000000076159a in SrsServer::do_on_tcp_client (this=0x38b7, listener=0x2, stfd=@0x7f6ab4008bd0: 0x7f6ab28b34f0)
    at ./src/app/srs_app_server.cpp:1239
Backtrace stopped: frame did not save the PC
@winlinvip winlinvip added the EnglishNative This issue is conveyed exclusively in English. label Dec 5, 2023
@winlinvip winlinvip added Bug It might be a bug. good first issue Easy to fix issues, good for newcomers help wanted Extra attention is needed labels Dec 14, 2023
@winlinvip
Copy link
Member

winlinvip commented Dec 14, 2023

This issue appears to be consistently reproducible. You are welcome to submit a patch.

TRANS_BY_GPT4

chundonglinlin added a commit to chundonglinlin/srs that referenced this issue Dec 18, 2023
winlinvip pushed a commit that referenced this issue Dec 30, 2023
…ion. v6.0.107 (#3914)

Description
A crash occurs when a forward relay connection has not been established
and an unpublish event is triggered simultaneously. For instance, if DVR
and forward are configured with a specified DVR path that already
exists, initiating a stream will trigger a crash.

Objective
Fix the crash caused by the forward mechanism.

Additional Information
For detailed reproduction steps, please refer to issue #3901.

---------

Co-authored-by: john <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug It might be a bug. EnglishNative This issue is conveyed exclusively in English. good first issue Easy to fix issues, good for newcomers help wanted Extra attention is needed
Projects
None yet
3 participants