RESOLVED FIXED 170492
WebRTC aborts when trying to sleep on a wrong thread
https://bugs.webkit.org/show_bug.cgi?id=170492
Summary WebRTC aborts when trying to sleep on a wrong thread
Alexey Proskuryakov
Reported 2017-04-04 22:06:30 PDT
Saw a crash on webrtc/datachannel/bufferedAmountLowThreshold.html: Thread 5 Crashed:: Thread 0x0x7f9697406b 0 libsystem_kernel.dylib 0x00007fffcfe31dd6 __pthread_kill + 10 1 libsystem_pthread.dylib 0x00007fffcff1d787 pthread_kill + 90 2 libsystem_c.dylib 0x00007fffcfd97420 abort + 129 3 libwebrtc.dylib 0x000000010ca65eb4 rtc::FatalMessage::~FatalMessage() + 452 4 libwebrtc.dylib 0x000000010ca65ed5 rtc::FatalMessage::~FatalMessage() + 21 5 libwebrtc.dylib 0x000000010d03c8e1 rtc::Thread::AssertBlockingIsAllowedOnCurrentThread() + 209 (thread.cc:298) 6 libwebrtc.dylib 0x000000010d03c6e3 rtc::Thread::SleepMs(int) + 19 (thread.cc:174) 7 libwebrtc.dylib 0x000000010d18bc21 cricket::SctpTransport::UsrSctpWrapper::UninitializeUsrSctp() + 241 (sctptransport.cc:264) 8 libwebrtc.dylib 0x000000010d1844a9 cricket::SctpTransport::UsrSctpWrapper::DecrementUsrSctpUsageCount() + 57 (sctptransport.cc:281) 9 libwebrtc.dylib 0x000000010d17fe92 cricket::SctpTransport::CloseSctpSocket() + 306 (sctptransport.cc:755) 10 libwebrtc.dylib 0x000000010d17fce5 cricket::SctpTransport::~SctpTransport() + 53 (sctptransport.cc:401) 11 libwebrtc.dylib 0x000000010d17ff35 cricket::SctpTransport::~SctpTransport() + 21 (sctptransport.cc:401) 12 libwebrtc.dylib 0x000000010d17ff79 cricket::SctpTransport::~SctpTransport() + 25 (sctptransport.cc:398) 13 libwebrtc.dylib 0x000000010cdbd908 webrtc::WebRtcSession::DestroySctpTransport_n() + 440 (memory:2724) 14 libwebrtc.dylib 0x000000010cddac94 void rtc::MethodFunctor<webrtc::WebRtcSession, void (webrtc::WebRtcSession::*)(), void>::CallMethod<>(rtc::sequence<>) const + 100 (bind.h:164) 15 libwebrtc.dylib 0x000000010cddac25 rtc::MethodFunctor<webrtc::WebRtcSession, void (webrtc::WebRtcSession::*)(), void>::operator()() const + 21 (bind.h:155) 16 libwebrtc.dylib 0x000000010cddac00 rtc::FunctorMessageHandler<void, rtc::MethodFunctor<webrtc::WebRtcSession, void (webrtc::WebRtcSession::*)(), void> >::OnMessage(rtc::Message*) + 32 (messagehandler.h:66) 17 libwebrtc.dylib 0x000000010d03dd9e rtc::Thread::ReceiveSendsFromThread(rtc::Thread const*) + 126 (thread.cc:425) 18 libwebrtc.dylib 0x000000010d03de29 rtc::Thread::ReceiveSends() + 25 (thread.cc:409) 19 libwebrtc.dylib 0x000000010cc21bfd rtc::MessageQueue::Get(rtc::Message*, int, bool) + 189 (messagequeue.cc:296) 20 libwebrtc.dylib 0x000000010d03d19c rtc::Thread::ProcessMessages(int) + 140 (thread.cc:494)
Attachments
crash log (90.88 KB, text/plain)
2017-04-04 22:06 PDT, Alexey Proskuryakov
no flags
Patch (2.05 KB, patch)
2017-04-04 22:32 PDT, youenn fablet
no flags
Archive of layout-test-results from ews107 for mac-elcapitan-wk2 (846.65 KB, application/zip)
2017-04-04 23:40 PDT, Build Bot
no flags
Patch (1.95 KB, patch)
2017-04-06 10:22 PDT, youenn fablet
no flags
Alexey Proskuryakov
Comment 1 2017-04-04 22:06:58 PDT
Created attachment 306251 [details] crash log
Radar WebKit Bug Importer
Comment 2 2017-04-04 22:07:19 PDT
youenn fablet
Comment 3 2017-04-04 22:10:29 PDT
(In reply to Radar WebKit Bug Importer from comment #2) > <rdar://problem/31446377> Probably the same as 31375728
youenn fablet
Comment 4 2017-04-04 22:32:08 PDT
Alexey Proskuryakov
Comment 5 2017-04-04 22:54:10 PDT
Is this really the right thing to do? Blocking a network thread is generally not advisable, especially in real time communication.
Build Bot
Comment 6 2017-04-04 23:40:36 PDT
Comment on attachment 306252 [details] Patch Attachment 306252 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/3475974 New failing tests: fast/mediastream/getUserMedia-webaudio.html
Build Bot
Comment 7 2017-04-04 23:40:37 PDT
Created attachment 306263 [details] Archive of layout-test-results from ews107 for mac-elcapitan-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews107 Port: mac-elcapitan-wk2 Platform: Mac OS X 10.11.6
Eric Carlson
Comment 8 2017-04-06 09:39:12 PDT
Comment on attachment 306252 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=306252&action=review > Source/ThirdParty/libwebrtc/Source/webrtc/media/sctp/sctptransport.cc:262 > if (usrsctp_finish() == 0) { > return; It OK to leave the thread accepting blocking calls?
youenn fablet
Comment 9 2017-04-06 10:04:02 PDT
> Is this really the right thing to do? Blocking a network thread is generally > not advisable, especially in real time communication. Agreed, that is far from ideal. Moving to asynchronous finishing might be difficult in the case where data channels might get created when others are deleted. We could reduce the blocking case by calling IncrementUsrSctpUsageCount() ourselves so that finish usrsctp would only happen at the end of the process and where blocking is fine. But the issue is that we would not free memory until that time. All in all, that is how libwebrtc is implemented and working right now. So I am not sure this is worth the effort to maintain something different ourselves. > Is it OK to leave the thread accepting blocking calls? Right, SetAllowBlockingCalls should be moved closer to Sleep.
youenn fablet
Comment 10 2017-04-06 10:22:16 PDT
WebKit Commit Bot
Comment 11 2017-04-06 11:53:20 PDT
Comment on attachment 306400 [details] Patch Clearing flags on attachment: 306400 Committed r215049: <http://trac.webkit.org/changeset/215049>
WebKit Commit Bot
Comment 12 2017-04-06 11:53:22 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.