EricssonResearch / scream

SCReAM - Mobile optimised congestion control algorithm
BSD 2-Clause "Simplified" License
174 stars 53 forks source link

Rust screamtx crash when RtpQueue was cleared #57

Closed realuptime closed 9 months ago

realuptime commented 9 months ago

Maybe some thread locking around the RtpQeue in ScreamTx (one thread inserting, another clearing).

================================================================= Got a SIGSEGV while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries used by your application.

Caught fatal signal - signo:11 code:1 errno:0 addr:0x40 Obtained 17 stack frames.

0 0x007f9501d10420 in funlockfile

1 0x007f93c001b575 in packet_free(void*, unsigned int)

2 0x007f93c0012367 in RtpQueue::clear()

3 0x007f93c0017772 in ScreamTx::newMediaFrame(unsigned int, unsigned int, int, bool)

4 0x007f93c001b8b0 in ScreamSenderPush

5 0x007f937307c50c in gstscream::screamtx::imp::Screamtx::sink_chain::h16200a4896ed69fc

6 0x007f937307bc41 in _$LT$T$u20$as$u20$gstreamer..subclass..element..ElementImplExt$GT$::catch_panic_pad_function::hdff007fc4fa9d5a3

7 0x007f937308e65b in gstreamer::pad::trampoline_chain_function::hf3128766d4e94aab

8 0x007f944c720a58 in gst_pad_chain_data_unchecked

9 0x007f944c722ed9 in gst_pad_push_data

10 0x007f944c72a093 in gst_pad_push

11 0x007f93c0067bf4 in gst_queue_loop

12 0x007f944c75a207 in gst_task_func

13 0x007f944c573e04 in g_thread_pool_thread_proxy

14 0x007f944c573561 in g_thread_proxy

15 0x007f9501d04609 in start_thread

16 0x007f9501c27133 in clone

jacobt21 commented 9 months ago

I'll need to test more but the following should work diff --git a/code/wrapper_lib/screamtx_plugin_wrapper.cpp b/code/wrapper_lib/screamtx_plugin_wrapper.cpp index 8b0a547..af91ad6 100644 --- a/code/wrapper_lib/screamtx_plugin_wrapper.cpp +++ b/code/wrapper_lib/screamtx_plugin_wrapper.cpp @@ -192,7 +192,9 @@ void transmitRtpThread(void arg) { pthread_mutex_lock(&stream->lock_rtp_queue); stream->rtpQueue->pop(&buf, size, ssrc, seqNr, isMark); pthread_mutex_unlock(&stream->lock_rtp_queue);

jacobt21 commented 9 months ago

Pushed the fix.