-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
srs crash when frequently do TCP connect, webrtc publish/play and disconnect. #3864
Comments
some more information. before crash [2023-11-06 13:10:57.366][WARN][1][j498ff67][0] DTLS: SSL3 alert method=read type=warning, desc=CN(close notify), where=16388, ret=256, r1=0 |
Base on the srs source, I suggest check |
another crash
so, I think maybe make |
This issue seems to occur because when closing the TCP connection, there are still coroutines reading and writing data, causing the Although reference counting or smart pointers can solve the problem, the best solution is to wait until the TCP connection is closed and there are no reading or writing coroutines before releasing the object. In other words, there is no need for smart pointers here; instead, the object release process should be improved. |
more crash
|
Dup to #3784 (comment) |
Describe the bug
A video chat webapp, using srs's js sdk. If 4, 5 or more people do tcp publish and play, and someone may refresh page, the srs server will crash.
Version
6
Additional context
crash log
=================================================================
==1==ERROR: AddressSanitizer: heap-use-after-free on address 0x6040012d2dd8 at pc 0x55faa2b08e65 bp 0x7f6acf07ed60 sp 0x7f6acf07ed50
READ of size 8 at 0x6040012d2dd8 thread T1 (srs-hybrid-2)
#0 0x55faa2b08e64 in SrsRtcTcpNetwork::write(void*, unsigned long, long*) src/app/srs_app_rtc_network.cpp:672
#1 0x55faa2a93f41 in SrsRtcConnection::do_send_packet(SrsRtpPacket*) src/app/srs_app_rtc_conn.cpp:2491
#2 0x55faa2b475aa in SrsRtcAudioSendTrack::on_rtp(SrsRtpPacket*) src/app/srs_app_rtc_source.cpp:2793
#3 0x55faa2a7dfcb in SrsRtcPlayStream::send_packet(SrsRtpPacket*&) src/app/srs_app_rtc_conn.cpp:735
#4 0x55faa2a7cdbe in SrsRtcPlayStream::cycle() src/app/srs_app_rtc_conn.cpp:670
#5 0x55faa27f7459 in SrsFastCoroutine::cycle() src/app/srs_app_st.cpp:285
#6 0x55faa27f75a9 in SrsFastCoroutine::pfn(void*) src/app/srs_app_st.cpp:300
#7 0x55faa2bb3520 in _st_thread_main /srs/trunk/objs/Platform-SRS6-Linux-5.15.0-GCC9.4.0-x86_64/st-srs/sched.c:380
#8 0x55faa2bb3e46 in st_thread_create /srs/trunk/objs/Platform-SRS6-Linux-5.15.0-GCC9.4.0-x86_64/st-srs/sched.c:666
0x6040012d2dd8 is located 8 bytes inside of 48-byte region [0x6040012d2dd0,0x6040012d2e00)
freed by thread T1 (srs-hybrid-2) here:
#0 0x55faa24b67af in operator delete(void*) (/usr/local/srs/objs/srs+0x4d37af)
previously allocated by thread T1 (srs-hybrid-2) here:
#0 0x55faa24b5817 in operator new(unsigned long) (/usr/local/srs/objs/srs+0x4d2817)
Thread T1 (srs-hybrid-2) created by T0 here:
#0 0x55faa23e0ad5 in __interceptor_pthread_create (/usr/local/srs/objs/srs+0x3fdad5)
#1 0x55faa2a39df3 in SrsThreadPool::execute(std::__cxx11::basic_string<char, std::char_traits, std::allocator >, SrsCplxError* ()(void), void*) src/app/srs_app_threads.cpp:676
#2 0x55faa2bb1e55 in run_in_thread_pool() src/main/srs_main_server.cpp:517
#3 0x55faa2bb18bd in run_directly_or_daemon() src/main/srs_main_server.cpp:456
#4 0x55faa2bae98e in do_main(int, char**, char**) src/main/srs_main_server.cpp:245
#5 0x55faa2baeca9 in main src/main/srs_main_server.cpp:256
#6 0x7f6ad4b86082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082)
SUMMARY: AddressSanitizer: heap-use-after-free src/app/srs_app_rtc_network.cpp:672 in SrsRtcTcpNetwork::write(void*, unsigned long, long*)
Shadow bytes around the buggy address:
0x0c0880252560: fa fa fd fd fd fd fd fa fa fa fd fd fd fd fd fa
0x0c0880252570: fa fa fd fd fd fd fd fa fa fa fd fd fd fd fd fd
0x0c0880252580: fa fa fd fd fd fd fd fa fa fa fd fd fd fd fd fa
0x0c0880252590: fa fa 00 00 00 00 00 04 fa fa fd fd fd fd fd fa
0x0c08802525a0: fa fa fd fd fd fd fd fa fa fa fd fd fd fd fd fa
=>0x0c08802525b0: fa fa fd fd fd fd fd fd fa fa fd[fd]fd fd fd fd
0x0c08802525c0: fa fa fd fd fd fd fd fa fa fa fd fd fd fd fd fa
0x0c08802525d0: fa fa fd fd fd fd fd fa fa fa fd fd fd fd fd fa
0x0c08802525e0: fa fa fd fd fd fd fd fa fa fa fd fd fd fd fd fa
0x0c08802525f0: fa fa fd fd fd fd fd fa fa fa fd fd fd fd fd fd
0x0c0880252600: fa fa fd fd fd fd fd fd fa fa fd fd fd fd fd fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
Shadow gap: cc
The text was updated successfully, but these errors were encountered: