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

HLS: Support reload HLS asynchronously. v5.0.172 v6.0.67 #3782

Merged
merged 4 commits into from
Aug 25, 2023

Conversation

winlinvip
Copy link
Member

@winlinvip winlinvip commented Aug 23, 2023

When reloading HLS, it directly operates unpublish and publish. At this time, if HLS is pushed, an exception may occur. The crash log is displayed as:

[2023-08-19 11:36:37.649][INFO][1][mo5u8823] HLS: Switch audio codec 16(Other) to 10(AAC)

[2023-08-19 11:36:37.659][ERROR][1][mo5u8823][0] backtrace 18 frames of ./objs/srs SRS/5.0.170(Bee)
AddressSanitizer:DEADLYSIGNAL
=================================================================
==1==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f8e0289e941 bp 0x7f8e02a34588 sp 0x7f8dfc2e1400 T1)
==1==The signal is caused by a READ memory access.
==1==Hint: address points to the zero page.
    #0 0x7f8e0289e940 in abort (/lib/x86_64-linux-gnu/libc.so.6+0x22940)
    #1 0x7f8e0289e728  (/lib/x86_64-linux-gnu/libc.so.6+0x22728)
    #2 0x7f8e028affd5 in __assert_fail (/lib/x86_64-linux-gnu/libc.so.6+0x33fd5)
    #3 0x55e98f7aa811 in SrsCplxError::srs_assert(bool) src/kernel/srs_kernel_error.cpp:446
    #4 0x55e98fa4ec89 in SrsHlsMuxer::is_segment_absolutely_overflow() src/app/srs_app_hls.cpp:535
    #5 0x55e98fa58150 in SrsHlsController::write_audio(SrsAudioFrame*, long) src/app/srs_app_hls.cpp:1008
    #6 0x55e98fa5b772 in SrsHls::on_audio(SrsSharedPtrMessage*, SrsFormat*) src/app/srs_app_hls.cpp:1315
    #7 0x55e98fa1adfe in SrsOriginHub::on_audio(SrsSharedPtrMessage*) src/app/srs_app_source.cpp:966
    #8 0x55e98fa2e82d in SrsLiveSource::on_audio_imp(SrsSharedPtrMessage*) src/app/srs_app_source.cpp:2320
    #9 0x55e98fa2db3f in SrsLiveSource::on_audio(SrsCommonMessage*) src/app/srs_app_source.cpp:2269
    #10 0x55e98fa0a913 in SrsRtmpConn::process_publish_message(SrsLiveSource*, SrsCommonMessage*) src/app/srs_app_rtmp_conn.cpp:1187
    #11 0x55e98fa0a5a0 in SrsRtmpConn::handle_publish_message(SrsLiveSource*, SrsCommonMessage*) src/app/srs_app_rtmp_conn.cpp:1166
    #12 0x55e98fc1fd53 in SrsPublishRecvThread::consume(SrsCommonMessage*) src/app/srs_app_recv_thread.cpp:373
    #13 0x55e98fc1d5b9 in SrsRecvThread::do_cycle() src/app/srs_app_recv_thread.cpp:131
    #14 0x55e98fc1d03a in SrsRecvThread::cycle() src/app/srs_app_recv_thread.cpp:100
    #15 0x55e98fa80e93 in SrsFastCoroutine::cycle() src/app/srs_app_st.cpp:285
    #16 0x55e98fa80fe3 in SrsFastCoroutine::pfn(void*) src/app/srs_app_st.cpp:300
    #17 0x55e98fe320c9 in _st_thread_main /srs/trunk/objs/Platform-SRS5-Linux-5.15.0-GCC9.4.0-x86_64/st-srs/sched.c:380
    #18 0x55e98fe329ef in st_thread_create /srs/trunk/objs/Platform-SRS5-Linux-5.15.0-GCC9.4.0-x86_64/st-srs/sched.c:666
    #19 0x55e990230647  (/usr/local/srs/objs/srs+0xf78647)

The reason is that these two coroutines operated on the HLS object at the same time, causing a null pointer.

Solution: Use asynchronous reload. During reload, only set variables and let the message processing coroutine implement the reload.


TRANS_BY_GPT4


Co-authored-by: Haibo Chen [email protected]
Co-authored-by: chundonglinlin [email protected]

@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Aug 23, 2023
@winlinvip winlinvip linked an issue Aug 23, 2023 that may be closed by this pull request
@winlinvip winlinvip added this to the 5.0 milestone Aug 23, 2023
@winlinvip winlinvip changed the title HLS: Support reload HLS asynchronously. HLS: Support reload HLS asynchronously. v5.0.172 v6.0.67 Aug 25, 2023
@winlinvip winlinvip added the RefinedByAI Refined by AI/GPT. label Aug 25, 2023
@winlinvip winlinvip merged commit 4031204 into ossrs:develop Aug 25, 2023
17 checks passed
winlinvip added a commit that referenced this pull request Aug 25, 2023
When reloading HLS, it directly operates unpublish and publish. At this
time, if HLS is pushed, an exception may occur.

The reason is that these two coroutines operated on the HLS object at
the same time, causing a null pointer.

Solution: Use asynchronous reload. During reload, only set variables and
let the message processing coroutine implement the reload.

---------

Co-authored-by: Haibo Chen <[email protected]>
Co-authored-by: chundonglinlin <[email protected]>
winlinvip added a commit that referenced this pull request Aug 25, 2023
When reloading HLS, it directly operates unpublish and publish. At this
time, if HLS is pushed, an exception may occur.

The reason is that these two coroutines operated on the HLS object at
the same time, causing a null pointer.

Solution: Use asynchronous reload. During reload, only set variables and
let the message processing coroutine implement the reload.

---------

Co-authored-by: Haibo Chen <[email protected]>
Co-authored-by: chundonglinlin <[email protected]>
duiniuluantanqin added a commit to duiniuluantanqin/srs that referenced this pull request Sep 14, 2023
When reloading HLS, it directly operates unpublish and publish. At this
time, if HLS is pushed, an exception may occur.

The reason is that these two coroutines operated on the HLS object at
the same time, causing a null pointer.

Solution: Use asynchronous reload. During reload, only set variables and
let the message processing coroutine implement the reload.

---------

Co-authored-by: Haibo Chen <[email protected]>
Co-authored-by: chundonglinlin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RefinedByAI Refined by AI/GPT. TransByAI Translated by AI/GPT.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HLS: Crash when publishing and reloading simultenously
3 participants