medooze / media-server-node

WebRTC Media Server for Node.js
MIT License
804 stars 119 forks source link

Assertion failed: (std::this_thread::get_id()==thread.get_id()), function AssertThread, file ../media-server/include/EventLoop.h, line 82. #97

Closed dt-atkinson closed 5 years ago

dt-atkinson commented 5 years ago

New benchmarking issue!

[0x70000c038000][1565894211.519][DBG]-RTPSession::onRTPPacket(Audio) | Dropped packet [orig:268669815,ssrc:268669815,seq:26778,rtx:0]
[0x700009e72000][1565894211.519][LOG]-RemoteRateEstimator adding stream [ssrc:569074840]
[0x70000b3f0000][1565894211.519][LOG]-RTPTransport::ReadRTP() | NAT: received packet from new source [127.0.0.1:20534]
[0x70000b3f0000][1565894211.519][LOG]-RTPSession::onRemotePeer(Audio) [127.0.0.1:20534]
[0x70000b3f0000][1565894211.519][LOG]-RTPSession::onRTPPacket(Audio) | New SSRC [new:2129782051,old:0]
[0x70000b3f0000][1565894211.519][LOG]-RemoteRateEstimator adding stream [ssrc:2129782051]
Assertion failed: (std::this_thread::get_id()==thread.get_id()), function AssertThread, file ../media-server/include/EventLoop.h, line 82.
[0x700009d6c000][1565894211.519][LOG]-RTPSession::onRTPPacket(Audio) | New SSRC [new:483173049,old:2113842594]
[0x700009d6c000][1565894211.519][LOG]-RemoteRateEstimator adding stream [ssrc:483173049]
[0x70000bb1a000][1565894211.519][LOG]-RTPSession::onRTPPacket(Audio) | New SSRC [new:1980873249,old:286893180]

Process finished with exit code 134 (interrupted by signal 6: SIGABRT)

How can I proceed to get more valuable information?

murillo128 commented 5 years ago

could you get a backtrace?

El jue., 15 ago. 2019 20:38, David Atkinson notifications@github.com escribió:

New benchmarking issue!

[0x70000c038000][1565894211.519][DBG]-RTPSession::onRTPPacket(Audio) | Dropped packet [orig:268669815,ssrc:268669815,seq:26778,rtx:0] [0x700009e72000][1565894211.519][LOG]-RemoteRateEstimator adding stream [ssrc:569074840] [0x70000b3f0000][1565894211.519][LOG]-RTPTransport::ReadRTP() | NAT: received packet from new source [127.0.0.1:20534] [0x70000b3f0000][1565894211.519][LOG]-RTPSession::onRemotePeer(Audio) [127.0.0.1:20534] [0x70000b3f0000][1565894211.519][LOG]-RTPSession::onRTPPacket(Audio) | New SSRC [new:2129782051,old:0] [0x70000b3f0000][1565894211.519][LOG]-RemoteRateEstimator adding stream [ssrc:2129782051] Assertion failed: (std::this_thread::get_id()==thread.get_id()), function AssertThread, file ../media-server/include/EventLoop.h, line 82. [0x700009d6c000][1565894211.519][LOG]-RTPSession::onRTPPacket(Audio) | New SSRC [new:483173049,old:2113842594] [0x700009d6c000][1565894211.519][LOG]-RemoteRateEstimator adding stream [ssrc:483173049] [0x70000bb1a000][1565894211.519][LOG]-RTPSession::onRTPPacket(Audio) | New SSRC [new:1980873249,old:286893180]

Process finished with exit code 134 (interrupted by signal 6: SIGABRT)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/medooze/media-server-node/issues/97?email_source=notifications&email_token=AAIFN4Z5XDNCHT5MARJI7OTQEWPDBA5CNFSM4IMAYF32YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HFPYW5Q, or mute the thread https://github.com/notifications/unsubscribe-auth/AAIFN45SBJ2WNF4GXO3T76DQEWPDBANCNFSM4IMAYF3Q .

dt-atkinson commented 5 years ago

Not sure how much help it is:

[New Thread 0x7f46b3fb7700 (LWP 8140)]
[New Thread 0x7f46b37b6700 (LWP 8141)]

Thread 14145 "node" received signal SIGABRT, Aborted.
[Switching to Thread 0x7f46b3fb7700 (LWP 8140)]
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51  ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007f472ede7801 in __GI_abort () at abort.c:79
#2  0x00007f472edd739a in __assert_fail_base (fmt=0x7f472ef5e7d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=assertion@entry=0x7f472c328bc0 "std::this_thread::get_id()==thread.get_id()", 
    file=file@entry=0x7f472c328b98 "../media-server/include/EventLoop.h", line=line@entry=82, 
    function=function@entry=0x7f472c329680 <EventLoop::AssertThread() const::__PRETTY_FUNCTION__> "void EventLoop::AssertThread() const")
    at assert.c:92
#3  0x00007f472edd7412 in __GI___assert_fail (assertion=assertion@entry=0x7f472c328bc0 "std::this_thread::get_id()==thread.get_id()", 
    file=file@entry=0x7f472c328b98 "../media-server/include/EventLoop.h", line=line@entry=82, 
    function=function@entry=0x7f472c329680 <EventLoop::AssertThread() const::__PRETTY_FUNCTION__> "void EventLoop::AssertThread() const")
    at assert.c:101
#4  0x00007f472c20ea65 in EventLoop::AssertThread (this=0x54510f0) at ../media-server/include/EventLoop.h:82
#5  EventLoop::CancelTimer (this=0x54510f0, timer=std::shared_ptr<EventLoop::TimerImpl> (use count 3, weak count 1) = {...})
    at ../media-server/src/EventLoop.cpp:335
#6  0x00007f472c20f0a0 in EventLoop::TimerImpl::<lambda(...)>::operator() (__closure=0x7f46fc01a410)
    at ../media-server/src/EventLoop.cpp:320
#7  std::_Function_handler<void(std::chrono::duration<long int, std::ratio<1, 1000> >), EventLoop::TimerImpl::Again(const milliseconds&)::<lambda(...)> >::_M_invoke(const std::_Any_data &, std::chrono::duration<long, std::ratio<1, 1000> > &&) (__functor=..., __args#0=...)
    at /usr/include/c++/7/bits/std_function.h:316
#8  0x00007f472c21306e in std::function<void (std::chrono::duration<long, std::ratio<1l, 1000l> >)>::operator()(std::chrono::duration<long, std::ratio<1l, 1000l> >) const (__args#0=..., this=0x7f46b3fb6138) at /usr/include/c++/7/bits/std_function.h:706
#9  EventLoop::Run (this=<optimized out>, duration=...) at ../media-server/src/EventLoop.cpp:532
#10 0x00007f472c214b62 in EventLoop::<lambda(...)>::operator() (__closure=<optimized out>) at ../media-server/src/EventLoop.cpp:155
#11 std::__invoke_impl<void, EventLoop::Start(int)::<lambda(...)> > (__f=...) at /usr/include/c++/7/bits/invoke.h:60
#12 std::__invoke<EventLoop::Start(int)::<lambda(...)> > (__fn=...) at /usr/include/c++/7/bits/invoke.h:95
#13 std::thread::_Invoker<std::tuple<EventLoop::Start(int)::<lambda(...)> > >::_M_invoke<0> (this=<optimized out>)
    at /usr/include/c++/7/thread:234
#14 std::thread::_Invoker<std::tuple<EventLoop::Start(int)::<lambda(...)> > >::operator() (this=<optimized out>)
    at /usr/include/c++/7/thread:243
#15 std::thread::_State_impl<std::thread::_Invoker<std::tuple<EventLoop::Start(int)::<lambda(...)> > > >::_M_run(void) (
    this=<optimized out>) at /usr/include/c++/7/thread:186
#16 0x00007f472fa2a66f in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#17 0x00007f472f19f6db in start_thread (arg=0x7f46b3fb7700) at pthread_create.c:463
#18 0x00007f472eec888f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
murillo128 commented 5 years ago

I think it is a race condition in

thread = std::thread([this](...){ Run(); });

and the Run() method itself, where the assertion is reached before the thread is set. We can remove the assertion check as it can't be called from 'userland' code and it is just an internal check for development. Will do it on monday.

dt-atkinson commented 5 years ago

Looks like you are right - I have commented out this line and ran my benchmark again and this doesn't appear to be being hit now.