New issue
Advanced search Search tips

Issue 793486 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Mac
Pri: 2
Type: Bug



Sign in to add a comment

DCHECK in remoting host during VideoSendStream creation

Project Member Reported by lambroslambrou@chromium.org, Dec 8 2017

Issue description

What steps will reproduce the problem?
(1) Build and install remote_assistance_host
(2) Run Chrome with --enable-logging=stderr
(3) Generate It2Me code and try to connect to it.

Result:

[1208/145514.123910:FATAL:thread_restrictions.cc(105)] Check failed: !g_base_sync_primitives_disallowed.Get().Get(). Waiting on a //base sync primitive is not allowed on this thread to prevent jank and deadlock. If waiting on a //base sync primitive is unavoidable, do it within the scope of a ScopedAllowBaseSyncPrimitives. If in a test, use ScopedAllowBaseSyncPrimitivesForTesting.
0   remote_assistance_host              0x0000000102dd301e base::debug::StackTrace::StackTrace(unsigned long) + 174
1   remote_assistance_host              0x0000000102dd307d base::debug::StackTrace::StackTrace(unsigned long) + 29
2   remote_assistance_host              0x0000000102dd143c base::debug::StackTrace::StackTrace() + 28
3   remote_assistance_host              0x0000000102e3ca8f logging::LogMessage::~LogMessage() + 479
4   remote_assistance_host              0x0000000102e3a2e5 logging::LogMessage::~LogMessage() + 21
5   remote_assistance_host              0x0000000103037848 base::internal::AssertBaseSyncPrimitivesAllowed() + 200
6   remote_assistance_host              0x0000000102facc6a base::WaitableEvent::TimedWaitUntil(base::TimeTicks const&) + 58
7   remote_assistance_host              0x0000000102facb5d base::WaitableEvent::Wait() + 77
8   remote_assistance_host              0x0000000101baec58 rtc::Event::Wait(int) + 56
9   remote_assistance_host              0x0000000105d6c4b2 webrtc::internal::VideoSendStream::VideoSendStream(int, webrtc::ProcessThread*, rtc::TaskQueue*, webrtc::CallStats*, webrtc::RtpTransportControllerSendInterface*, webrtc::BitrateAllocator*, webrtc::SendDelayStats*, webrtc::RtcEventLog*, webrtc::VideoSendStream::Config, webrtc::VideoEncoderConfig, std::__1::map<unsigned int, webrtc::RtpState, std::__1::less<unsigned int>, std::__1::allocator<std::__1::pair<unsigned int const, webrtc::RtpState> > > const&, std::__1::map<unsigned int, webrtc::RtpPayloadState, std::__1::less<unsigned int>, std::__1::allocator<std::__1::pair<unsigned int const, webrtc::RtpPayloadState> > > const&) + 2306
10  remote_assistance_host              0x0000000105d6cd5e webrtc::internal::VideoSendStream::VideoSendStream(int, webrtc::ProcessThread*, rtc::TaskQueue*, webrtc::CallStats*, webrtc::RtpTransportControllerSendInterface*, webrtc::BitrateAllocator*, webrtc::SendDelayStats*, webrtc::RtcEventLog*, webrtc::VideoSendStream::Config, webrtc::VideoEncoderConfig, std::__1::map<unsigned int, webrtc::RtpState, std::__1::less<unsigned int>, std::__1::allocator<std::__1::pair<unsigned int const, webrtc::RtpState> > > const&, std::__1::map<unsigned int, webrtc::RtpPayloadState, std::__1::less<unsigned int>, std::__1::allocator<std::__1::pair<unsigned int const, webrtc::RtpPayloadState> > > const&) + 206
11  remote_assistance_host              0x0000000105955925 webrtc::internal::Call::CreateVideoSendStream(webrtc::VideoSendStream::Config, webrtc::VideoEncoderConfig) + 2469
12  remote_assistance_host              0x0000000105ef571f cricket::WebRtcVideoChannel::WebRtcVideoSendStream::RecreateWebRtcStream() + 1823
13  remote_assistance_host              0x0000000105ef3c56 cricket::WebRtcVideoChannel::WebRtcVideoSendStream::SetCodec(cricket::WebRtcVideoChannel::VideoCodecSettings const&, bool) + 3414
14  remote_assistance_host              0x0000000105ee20f3 cricket::WebRtcVideoChannel::WebRtcVideoSendStream::SetSendParameters(cricket::WebRtcVideoChannel::ChangedSendParameters const&) + 803
15  remote_assistance_host              0x0000000105ee13ef cricket::WebRtcVideoChannel::SetSendParameters(cricket::VideoSendParameters const&) + 1951
16  remote_assistance_host              0x0000000105f9ddeb cricket::VideoChannel::SetRemoteContent_w(cricket::MediaContentDescription const*, webrtc::SdpType, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) + 1259
17  remote_assistance_host              0x0000000105faf361 bool rtc::MethodFunctor<cricket::BaseChannel, bool (cricket::BaseChannel::*)(cricket::MediaContentDescription const*, webrtc::SdpType, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*), bool, cricket::MediaContentDescription const*, webrtc::SdpType, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*>::CallMethod<0, 1, 2>(rtc::sequence<0, 1, 2>) const + 193
18  remote_assistance_host              0x0000000105faf295 rtc::MethodFunctor<cricket::BaseChannel, bool (cricket::BaseChannel::*)(cricket::MediaContentDescription const*, webrtc::SdpType, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*), bool, cricket::MediaContentDescription const*, webrtc::SdpType, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*>::operator()() const + 21
19  remote_assistance_host              0x0000000105faf271 rtc::FunctorMessageHandler<bool, rtc::MethodFunctor<cricket::BaseChannel, bool (cricket::BaseChannel::*)(cricket::MediaContentDescription const*, webrtc::SdpType, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*), bool, cricket::MediaContentDescription const*, webrtc::SdpType, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*> const&>::OnMessage(rtc::Message*) + 33
20  remote_assistance_host              0x0000000105797a4a jingle_glue::JingleThreadWrapper::Dispatch(rtc::Message*) + 378
21  remote_assistance_host              0x0000000105797d72 jingle_glue::JingleThreadWrapper::Send(rtc::Location const&, rtc::MessageHandler*, unsigned int, rtc::MessageData*) + 370
22  remote_assistance_host              0x0000000104336f07 rtc::Thread::InvokeInternal(rtc::Location const&, rtc::MessageHandler*) + 327
23  remote_assistance_host              0x0000000105faf106 bool rtc::Thread::Invoke<bool, rtc::MethodFunctor<cricket::BaseChannel, bool (cricket::BaseChannel::*)(cricket::MediaContentDescription const*, webrtc::SdpType, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*), bool, cricket::MediaContentDescription const*, webrtc::SdpType, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*> const&>(rtc::Location const&, rtc::MethodFunctor<cricket::BaseChannel, bool (cricket::BaseChannel::*)(cricket::MediaContentDescription const*, webrtc::SdpType, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*), bool, cricket::MediaContentDescription const*, webrtc::SdpType, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*> const&&&) + 86
24  remote_assistance_host              0x0000000105f8a5ec bool cricket::BaseChannel::InvokeOnWorker<bool, rtc::MethodFunctor<cricket::BaseChannel, bool (cricket::BaseChannel::*)(cricket::MediaContentDescription const*, webrtc::SdpType, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*), bool, cricket::MediaContentDescription const*, webrtc::SdpType, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*> >(rtc::Location const&, rtc::MethodFunctor<cricket::BaseChannel, bool (cricket::BaseChannel::*)(cricket::MediaContentDescription const*, webrtc::SdpType, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*), bool, cricket::MediaContentDescription const*, webrtc::SdpType, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*> const&) + 44
25  remote_assistance_host              0x0000000105f8a7d3 cricket::BaseChannel::SetRemoteContent(cricket::MediaContentDescription const*, webrtc::SdpType, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) + 323
26  remote_assistance_host              0x00000001060bf4c5 webrtc::PeerConnection::PushdownMediaDescription(webrtc::SdpType, cricket::ContentSource) + 1381
27  remote_assistance_host              0x00000001060a249b webrtc::PeerConnection::UpdateSessionState(webrtc::SdpType, cricket::ContentSource) + 1883
28  remote_assistance_host              0x00000001060a78c6 webrtc::PeerConnection::ApplyRemoteDescription(std::__1::unique_ptr<webrtc::SessionDescriptionInterface, std::__1::default_delete<webrtc::SessionDescriptionInterface> >) + 4214
29  remote_assistance_host              0x00000001060a5f97 webrtc::PeerConnection::SetRemoteDescription(std::__1::unique_ptr<webrtc::SessionDescriptionInterface, std::__1::default_delete<webrtc::SessionDescriptionInterface> >, rtc::scoped_refptr<webrtc::SetRemoteDescriptionObserverInterface>) + 1031
30  remote_assistance_host              0x00000001060a59e5 webrtc::PeerConnection::SetRemoteDescription(webrtc::SetSessionDescriptionObserver*, webrtc::SessionDescriptionInterface*) + 373
31  remote_assistance_host              0x000000010613f4a2 void webrtc::ReturnType<void>::Invoke<webrtc::PeerConnectionInterface, void (webrtc::PeerConnectionInterface::*)(webrtc::SetSessionDescriptionObserver*, webrtc::SessionDescriptionInterface*), webrtc::SetSessionDescriptionObserver*, webrtc::SessionDescriptionInterface*>(webrtc::PeerConnectionInterface*, void (webrtc::PeerConnectionInterface::*)(webrtc::SetSessionDescriptionObserver*, webrtc::SessionDescriptionInterface*), webrtc::SetSessionDescriptionObserver*, webrtc::SessionDescriptionInterface*) + 178
32  remote_assistance_host              0x000000010613f3e0 webrtc::MethodCall2<webrtc::PeerConnectionInterface, void, webrtc::SetSessionDescriptionObserver*, webrtc::SessionDescriptionInterface*>::OnMessage(rtc::Message*) + 96
33  remote_assistance_host              0x00000001057755c4 webrtc::internal::SynchronousMethodCall::Invoke(rtc::Location const&, rtc::Thread*) + 100
34  remote_assistance_host              0x000000010613f20d webrtc::MethodCall2<webrtc::PeerConnectionInterface, void, webrtc::SetSessionDescriptionObserver*, webrtc::SessionDescriptionInterface*>::Marshal(rtc::Location const&, rtc::Thread*) + 77
35  remote_assistance_host              0x00000001061329d2 webrtc::PeerConnectionProxyWithInternal<webrtc::PeerConnectionInterface>::SetRemoteDescription(webrtc::SetSessionDescriptionObserver*, webrtc::SessionDescriptionInterface*) + 226
36  remote_assistance_host              0x00000001055d6561 remoting::protocol::WebrtcTransport::ProcessTransportInfo(buzz::XmlElement*) + 6193
37  remote_assistance_host              0x000000010553a87b remoting::protocol::JingleSession::OnTransportInfo(std::__1::unique_ptr<remoting::protocol::JingleMessage, std::__1::default_delete<remoting::protocol::JingleMessage> >, base::RepeatingCallback<void (remoting::protocol::JingleMessageReply::ErrorType)> const&) + 1659
38  remote_assistance_host              0x0000000105539479 remoting::protocol::JingleSession::ProcessIncomingMessage(std::__1::unique_ptr<remoting::protocol::JingleMessage, std::__1::default_delete<remoting::protocol::JingleMessage> >, base::RepeatingCallback<void (remoting::protocol::JingleMessageReply::ErrorType)> const&) + 2377
39  remote_assistance_host              0x000000010553897b remoting::protocol::JingleSession::OnIncomingMessage(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::unique_ptr<remoting::protocol::JingleMessage, std::__1::default_delete<remoting::protocol::JingleMessage> >, base::RepeatingCallback<void (remoting::protocol::JingleMessageReply::ErrorType)> const&) + 1867
40  remote_assistance_host              0x000000010554855d remoting::protocol::JingleSessionManager::OnSignalStrategyIncomingStanza(buzz::XmlElement const*) + 8013
41  remote_assistance_host              0x00000001057a0272 remoting::DelegatingSignalStrategy::OnIncomingMessage(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 834
42  remote_assistance_host              0x00000001057a2dff void base::internal::FunctorTraits<void (remoting::DelegatingSignalStrategy::*)(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&), void>::Invoke<base::WeakPtr<remoting::DelegatingSignalStrategy> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&>(void (remoting::DelegatingSignalStrategy::*)(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&), base::WeakPtr<remoting::DelegatingSignalStrategy> const&&&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&&&) + 143
43  remote_assistance_host              0x00000001057a2d35 void base::internal::InvokeHelper<true, void>::MakeItSo<void (remoting::DelegatingSignalStrategy::* const&)(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&), base::WeakPtr<remoting::DelegatingSignalStrategy> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&>(void (remoting::DelegatingSignalStrategy::* const&&&)(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&), base::WeakPtr<remoting::DelegatingSignalStrategy> const&&&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&&&) + 117
44  remote_assistance_host              0x00000001057a2cad void base::internal::Invoker<base::internal::BindState<void (remoting::DelegatingSignalStrategy::*)(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&), base::WeakPtr<remoting::DelegatingSignalStrategy>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, void ()>::RunImpl<void (remoting::DelegatingSignalStrategy::* const&)(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&), std::__1::tuple<base::WeakPtr<remoting::DelegatingSignalStrategy>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&, 0ul, 1ul>(void (remoting::DelegatingSignalStrategy::* const&&&)(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&), std::__1::tuple<base::WeakPtr<remoting::DelegatingSignalStrategy>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&&&, std::__1::integer_sequence<unsigned long, 0ul, 1ul>) + 125
45  remote_assistance_host              0x00000001057a2bbc base::internal::Invoker<base::internal::BindState<void (remoting::DelegatingSignalStrategy::*)(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&), base::WeakPtr<remoting::DelegatingSignalStrategy>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, void ()>::Run(base::internal::BindStateBase*) + 44
46  remote_assistance_host              0x0000000101d1522f base::OnceCallback<void ()>::Run() && + 95
47  remote_assistance_host              0x0000000102dd50f4 base::debug::TaskAnnotator::RunTask(char const*, base::PendingTask*) + 884
48  remote_assistance_host              0x0000000102e71726 base::internal::IncomingTaskQueue::RunTask(base::PendingTask*) + 246
49  remote_assistance_host              0x0000000102e7da5b base::MessageLoop::RunTask(base::PendingTask*) + 923
50  remote_assistance_host              0x0000000102e7e079 base::MessageLoop::DeferOrRunPendingTask(base::PendingTask) + 89
51  remote_assistance_host              0x0000000102e7e3c9 base::MessageLoop::DoWork() + 569
52  remote_assistance_host              0x0000000102e89327 base::MessagePumpLibevent::Run(base::MessagePump::Delegate*) + 311
53  remote_assistance_host              0x0000000102e7d1df base::MessageLoop::Run(bool) + 591
54  remote_assistance_host              0x0000000102f3c2bd base::RunLoop::Run() + 605
55  remote_assistance_host              0x00000001018434f9 remoting::AutoThread::ThreadMain() + 1529
56  remote_assistance_host              0x0000000103005fea base::(anonymous namespace)::ThreadFunc(void*) + 682
57  libsystem_pthread.dylib             0x00007fffcdfaa93b _pthread_body + 180
58  libsystem_pthread.dylib             0x00007fffcdfaa887 _pthread_body + 0
59  libsystem_pthread.dylib             0x00007fffcdfaa08d thread_start + 13

 

Comment 1 Deleted

From chat with sergeyu@

We currently set the network thread to disallow blocking operations here:
https://codesearch.chromium.org/chromium/src/remoting/host/chromoting_host_context.cc?l=123&rcl=5c910fcccb97bdb3e40dc913e93c033161483708

In our PeerConnectionWrapper dtor, we use a ScopedAllowIO to work around a similar issue:
https://codesearch.chromium.org/chromium/src/remoting/protocol/webrtc_transport.cc?l=217&rcl=a8b389e6a5878933acb23a21dacd0a0cc3dbf09c

Perhaps we need a similar workaround when setting up the connection?
Note that WebRTC may block on other threads elsewhere, particularly when calling
rtc_base::Thread::Send().

Labels: OS-Linux
Summary: DCHECK in remoting host during VideoSendStream creation (was: DCHECK in remote_assistance_host on macOS during VideoSendStream creation)
Also occurs in remoting_me2me_host on Linux after a recent update:

[1208/190452.769101:FATAL:thread_restrictions.cc(105)] Check failed: !g_base_sync_primitives_disallowed.Get().Get(). Waiting on a //base sync primitive is not allowed on this thread to prevent jank and deadlock. If waiting on a //base sync primitive is unavoidable, do it within the scope of a ScopedAllowBaseSyncPrimitives. If in a test, use ScopedAllowBaseSyncPrimitivesForTesting.
#0 0x000001cb208d base::debug::StackTrace::StackTrace()
#1 0x000001cb061c base::debug::StackTrace::StackTrace()
#2 0x000001d0b40a logging::LogMessage::~LogMessage()
#3 0x000001e5a177 base::internal::AssertBaseSyncPrimitivesAllowed()
#4 0x000001dfb770 base::WaitableEvent::TimedWaitUntil()
#5 0x000001dfb66c base::WaitableEvent::Wait()
#6 0x00000120cd3a rtc::Event::Wait()
#7 0x0000041ee782 webrtc::internal::AudioSendStream::RemoveBitrateObserver()
#8 0x0000041ee532 webrtc::internal::AudioSendStream::Stop()
#9 0x0000045bcd78 cricket::WebRtcVoiceMediaChannel::WebRtcAudioSendStream::UpdateSendState()
#10 0x0000045b86ee cricket::WebRtcVoiceMediaChannel::WebRtcAudioSendStream::SetSend()
#11 0x0000045a9ad8 cricket::WebRtcVoiceMediaChannel::AddSendStream()
#12 0x000004693a6e cricket::BaseChannel::UpdateLocalStreams_w()
#13 0x000004698ba2 cricket::VoiceChannel::SetLocalContent_w()
#14 0x0000046acc01 _ZNK3rtc13MethodFunctorIN7cricket11BaseChannelEMS2_FbPKNS1_23MediaContentDescriptionEN6webrtc7SdpTypeEPNSt3__112basic_stringIcNS8_11char_traitsIcEENS8_9allocatorIcEEEEEbJS5_S7_SF_EE10CallMethodIJLi0ELi1ELi2EEEEbNS_8sequenceIJXspT_EEEE
#15 0x0000046acb35 _ZNK3rtc13MethodFunctorIN7cricket11BaseChannelEMS2_FbPKNS1_23MediaContentDescriptionEN6webrtc7SdpTypeEPNSt3__112basic_stringIcNS8_11char_traitsIcEENS8_9allocatorIcEEEEEbJS5_S7_SF_EEclEv
#16 0x0000046acb11 _ZN3rtc21FunctorMessageHandlerIbRKNS_13MethodFunctorIN7cricket11BaseChannelEMS3_FbPKNS2_23MediaContentDescriptionEN6webrtc7SdpTypeEPNSt3__112basic_stringIcNS9_11char_traitsIcEENS9_9allocatorIcEEEEEbJS6_S8_SG_EEEE9OnMessageEPNS_7MessageE
#17 0x00000338f393 jingle_glue::JingleThreadWrapper::Dispatch()
#18 0x00000338f661 jingle_glue::JingleThreadWrapper::Send()
#19 0x00000318add9 rtc::Thread::InvokeInternal()
#20 0x0000046aca56 _ZN3rtc6Thread6InvokeIbRKNS_13MethodFunctorIN7cricket11BaseChannelEMS4_FbPKNS3_23MediaContentDescriptionEN6webrtc7SdpTypeEPNSt3__112basic_stringIcNSA_11char_traitsIcEENSA_9allocatorIcEEEEEbJS7_S9_SH_EEEEET_RKNS_8LocationEOT0_
#21 0x0000046a424c _ZN7cricket11BaseChannel14InvokeOnWorkerIbN3rtc13MethodFunctorIS0_MS0_FbPKNS_23MediaContentDescriptionEN6webrtc7SdpTypeEPNSt3__112basic_stringIcNS9_11char_traitsIcEENS9_9allocatorIcEEEEEbJS6_S8_SG_EEEEET_RKNS2_8LocationERKT0_
#22 0x00000468dadf cricket::BaseChannel::SetLocalContent()
#23 0x00000464d98b webrtc::PeerConnection::PushdownMediaDescription()
#24 0x00000463405e webrtc::PeerConnection::UpdateSessionState()
#25 0x000004631d62 webrtc::PeerConnection::ApplyLocalDescription()
#26 0x0000046307be webrtc::PeerConnection::SetLocalDescription()
#27 0x000004603e54 webrtc::ReturnType<>::Invoke<>()
#28 0x000004603da0 webrtc::MethodCall2<>::OnMessage()
#29 0x000004688772 webrtc::internal::SynchronousMethodCall::Invoke()
#30 0x0000045f5f7c webrtc::MethodCall0<>::Marshal()
#31 0x0000045fec28 webrtc::PeerConnectionProxyWithInternal<>::SetLocalDescription()
#32 0x000003229940 remoting::protocol::WebrtcTransport::OnLocalSessionDescriptionCreated()
#33 0x000001a9c1e4 _ZN4base8internal13FunctorTraitsIMN5media4cast11AudioSenderEFvNSt3__110unique_ptrINS2_8AudioBusENS5_14default_deleteIS7_EEEERKNS_9TimeTicksEEvE6InvokeIRKNS_7WeakPtrIS4_EEJSA_SD_EEEvSF_OT_DpOT0_
#34 0x000001a9bff5 _ZN4base8internal12InvokeHelperILb1EvE8MakeItSoIRKMN5media4cast11AudioSenderEFvNSt3__110unique_ptrINS4_8AudioBusENS7_14default_deleteIS9_EEEERKNS_9TimeTicksEERKNS_7WeakPtrIS6_EEJSC_SF_EEEvOT_OT0_DpOT1_
#35 0x000003231650 _ZN4base8internal7InvokerINS0_9BindStateIMN8remoting8protocol15WebrtcTransportEFvNSt3__110unique_ptrIN6webrtc27SessionDescriptionInterfaceENS6_14default_deleteIS9_EEEERKNS6_12basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEEEJNS_7WeakPtrIS5_EEEEEFvSC_SK_EE7RunImplIRKSM_RKNS6_5tupleIJSO_EEEJLm0EEEEvOT_OT0_NS6_16integer_sequenceImJXspT1_EEEEOSC_SK_
#36 0x0000032315d4 _ZN4base8internal7InvokerINS0_9BindStateIMN8remoting8protocol15WebrtcTransportEFvNSt3__110unique_ptrIN6webrtc27SessionDescriptionInterfaceENS6_14default_deleteIS9_EEEERKNS6_12basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEEEJNS_7WeakPtrIS5_EEEEEFvSC_SK_EE3RunEPNS0_13BindStateBaseEOSC_SK_
#37 0x000003230de4 _ZNO4base17RepeatingCallbackIFvNSt3__110unique_ptrIN6webrtc27SessionDescriptionInterfaceENS1_14default_deleteIS4_EEEERKNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEE3RunES7_SF_
#38 0x00000322d089 remoting::protocol::(anonymous namespace)::CreateSessionDescriptionObserver::OnSuccess()
#39 0x00000487edba webrtc::WebRtcSessionDescriptionFactory::OnMessage()
#40 0x00000338f393 jingle_glue::JingleThreadWrapper::Dispatch()
#41 0x000003390019 jingle_glue::JingleThreadWrapper::RunTask()
#42 0x000000fcf9e1 _ZN4base8internal13FunctorTraitsIMN11google_apis19UrlFetchRequestBaseEFvNS2_17DriveApiErrorCodeEEvE6InvokeIRKNS_7WeakPtrIS3_EEJRKS4_EEEvS6_OT_DpOT0_
#43 0x000000fcf945 _ZN4base8internal12InvokeHelperILb1EvE8MakeItSoIRKMN11google_apis19UrlFetchRequestBaseEFvNS4_17DriveApiErrorCodeEERKNS_7WeakPtrIS5_EEJRKS6_EEEvOT_OT0_DpOT1_
#44 0x000000fcf8bd _ZN4base8internal7InvokerINS0_9BindStateIMN11google_apis19UrlFetchRequestBaseEFvNS3_17DriveApiErrorCodeEEJNS_7WeakPtrIS4_EES5_EEEFvvEE7RunImplIRKS7_RKNSt3__15tupleIJS9_S5_EEEJLm0ELm1EEEEvOT_OT0_NSG_16integer_sequenceImJXspT1_EEEE
#45 0x000000fcf7cc _ZN4base8internal7InvokerINS0_9BindStateIMN11google_apis19UrlFetchRequestBaseEFvNS3_17DriveApiErrorCodeEEJNS_7WeakPtrIS4_EES5_EEEFvvEE3RunEPNS0_13BindStateBaseE
#46 0x000001231aa1 _ZNO4base12OnceCallbackIFvvEE3RunEv
#47 0x000001d3882a base::debug::TaskAnnotator::RunTask()
#48 0x000001d33445 base::internal::IncomingTaskQueue::RunTask()
#49 0x000001d30c5a base::MessageLoop::RunTask()
#50 0x000001d30ef8 base::MessageLoop::DeferOrRunPendingTask()
#51 0x000001d31240 base::MessageLoop::DoWork()
#52 0x000001d3c439 base::MessagePumpLibevent::Run()
#53 0x000001d303de base::MessageLoop::Run()
#54 0x000001dad4cc base::RunLoop::Run()
#55 0x00000103a661 remoting::AutoThread::ThreadMain()
#56 0x000001e3d431 base::(anonymous namespace)::ThreadFunc()
#57 0x7f16bfb2a184 start_thread
#58 0x7f16baa47ffd clone



Components: Blink>WebRTC>PeerConnection
WebRTC folks, please could you take a look - perhaps some blocking operation was recently introduced when setting up a PeerConnection?

Cc: sergeyu@chromium.org
In the above stack trace, we call PeerConnection::SetLocalDescription(), which performs blocking operations under the hood.

In the first stack trace, we call PeerConnection::SetRemoteDescription() which does blocking stuff.

We need to find out if WebRTC's PeerConnection object can sensibly be used on the network thread? If not, we have to refactor remoting/protocol/webrtc_transport.cc

Comment 6 by guidou@chromium.org, Dec 13 2017

Cc: hbos@chromium.org

Comment 8 by hbos@chromium.org, Dec 13 2017

All PeerConnection APIs operates on the webrtc signaling thread. You must not use it on the network thread unless these threads are the same thread.

Comment 9 by hbos@chromium.org, Dec 13 2017

The webrtc signaling thread does blocking invokes on worker thread and network thread, so you don't want them to block on the webrtc signaling thread in return or risk deadlock.
Labels: -Pri-3 Pri-2
Owner: lambroslambrou@chromium.org
Status: Assigned (was: Untriaged)

Comment 11 by sergeyu@google.com, Dec 14 2017

chromoting host uses the same thread (called "network thread") as both signaling and worker thread for WebRTC, there should be no deadlocks.

In this particular case VideoSendStream waits for a task that runs an a background thread that PeerConnection creates internally, see https://codesearch.chromium.org/chromium/src/third_party/webrtc/call/call.cc?type=cs&sq=package:chromium&l=368 . That thread shouldn't be running any blocking or expensive operations, so that Event.Wait() is not expected to block for significant amount of time and there shouldn't be any negative effects from that blocking Wait(), i.e. it's acceptable to suppress this DCHECK with ScopedAllowBaseSyncPrimitives.

In general I'd prefer if WebRTC API allowed tighter control of the threads that are created/used under the hood, instead of just creating some arbitrary threads willy-nilly as it currently does.


After adding the scopers around SetLocalDescription() and SetRemoteDescription(), I am seeing the new backtrace below.
It looks like WebRTC (via the JingleThreadWrapper) is posting
a task onto our network thread, and this task is also
triggering a base/sync primitive.

Not sure what to do about this?

#0  base::debug::(anonymous namespace)::DebugBreak () at ../../base/debug/debugger_posix.cc:239
#1  0x0000000001ce4e48 in base::debug::BreakDebugger () at ../../base/debug/debugger_posix.cc:258
#2  0x0000000001d37f3a in logging::LogMessage::~LogMessage (this=0x7f7e6e9d79c0) at ../../base/logging.cc:844
#3  0x0000000001e858db in base::internal::AssertBaseSyncPrimitivesAllowed () at ../../base/threading/thread_restrictions.cc:105
#4  0x0000000001e2af10 in base::WaitableEvent::TimedWaitUntil (this=0x188a9ff03b70, end_time=...)
    at ../../base/synchronization/waitable_event_posix.cc:165
#5  0x0000000001e2ae1c in base::WaitableEvent::Wait (this=0x188a9ff03b70) at ../../base/synchronization/waitable_event_posix.cc:154
#6  0x000000000123fe3a in rtc::Event::Wait (this=0x188a9ff03b70, milliseconds=-1) at ../../third_party/webrtc_overrides/rtc_base/event.cc:31
#7  0x000000000453e5b8 in webrtc::internal::VideoSendStream::Start (this=0x188a9ff03b20) at ../../third_party/webrtc/video/video_send_stream.cc:609
#8  0x00000000046b3e5b in cricket::WebRtcVideoChannel::WebRtcVideoSendStream::UpdateSendState (this=0x188aa0264420)
    at ../../third_party/webrtc/media/engine/webrtcvideoengine.cc:1830
#9  0x00000000046a8099 in cricket::WebRtcVideoChannel::WebRtcVideoSendStream::SetSend (this=0x188aa0264420, send=true)
    at ../../third_party/webrtc/media/engine/webrtcvideoengine.cc:1917
#10 0x00000000046a7db6 in cricket::WebRtcVideoChannel::SetSend (this=0x188a9fcc88a0, send=true)
    at ../../third_party/webrtc/media/engine/webrtcvideoengine.cc:1027
#11 0x0000000004817835 in cricket::VideoChannel::UpdateMediaSendRecvState_w (this=0x188aa0661e20) at ../../third_party/webrtc/pc/channel.cc:1663
#12 0x00000000047f28e5 in rtc::MethodFunctor<cricket::PortAllocator, void (cricket::PortAllocator::*)(), void>::CallMethod<>(rtc::sequence<>) const (
    this=0x188a9ff985e8) at ../../third_party/webrtc/rtc_base/bind.h:164
#13 0x00000000047f2875 in rtc::MethodFunctor<cricket::PortAllocator, void (cricket::PortAllocator::*)(), void>::operator() (this=0x188a9ff985e8)
    at ../../third_party/webrtc/rtc_base/bind.h:155
#14 0x000000000482fcf9 in rtc::FireAndForgetAsyncClosure<rtc::MethodFunctor<cricket::BaseChannel, void (cricket::BaseChannel::*)(), void> >::Execute
    (this=0x188a9ff985d0) at ../../third_party/webrtc/rtc_base/asyncinvoker-inl.h:55
#15 0x00000000033a503e in rtc::AsyncInvoker::OnMessage (this=0x188aa0661f68, msg=0x7f7e6e9d8ea0)
    at ../../third_party/webrtc/rtc_base/asyncinvoker.cc:45
#16 0x00000000033b9183 in jingle_glue::JingleThreadWrapper::Dispatch (this=0x188aa0142b60, message=0x7f7e6e9d8ea0)
    at ../../jingle/glue/thread_wrapper.cc:157
#17 0x00000000033b9dcd in jingle_glue::JingleThreadWrapper::RunTask (this=0x188aa0142b60, task_id=179) at ../../jingle/glue/thread_wrapper.cc:279
#18 0x0000000001005ba1 in base::internal::FunctorTraits<void (google_apis::UrlFetchRequestBase::*)(google_apis::DriveApiErrorCode), void>::Invoke<base::WeakPtr<google_apis::UrlFetchRequestBase> const&, google_apis::DriveApiErrorCode const&> (method=
    (void (google_apis::UrlFetchRequestBase::*)(google_apis::UrlFetchRequestBase * const, google_apis::DriveApiErrorCode)) 0x33b9950 <jingle_glue::JingleThreadWrapper::RunTask(int)>, receiver_ptr=..., args=@0x188aa06d79e0: 179) at ../../base/bind_internal.h:211
#19 0x0000000001005b05 in base::internal::InvokeHelper<true, void>::MakeItSo<void (google_apis::UrlFetchRequestBase::* const&)(google_apis::DriveApiErrorCode), base::WeakPtr<google_apis::UrlFetchRequestBase> const&, google_apis::DriveApiErrorCode const&> (functor=
    @0x188aa06d79c0: (void (google_apis::UrlFetchRequestBase::*)(google_apis::UrlFetchRequestBase * const, google_apis::DriveApiErrorCode)) 0x33b9950 <jingle_glue::JingleThreadWrapper::RunTask(int)>, weak_ptr=..., args=@0x188aa06d79e0: 179) at ../../base/bind_internal.h:314
#20 0x0000000001005a7d in base::internal::Invoker<base::internal::BindState<void (google_apis::UrlFetchRequestBase::*)(google_apis::DriveApiErrorCode), base::WeakPtr<google_apis::UrlFetchRequestBase>, google_apis::DriveApiErrorCode>, void ()>::RunImpl<void (google_apis::UrlFetchRequestBase::* const&)(google_apis::DriveApiErrorCode), std::__1::tuple<base::WeakPtr<google_apis::UrlFetchRequestBase>, google_apis::DriveApiErrorCode> const&, 0ul, 1ul>(void (google_apis::UrlFetchRequestBase::* const&)(google_apis::DriveApiErrorCode), std::__1::tuple<base::WeakPtr<google_apis::UrlFetchRequestBase>, google_apis::DriveApiErrorCode> const&, std::__1::integer_sequence<unsigned long, 0ul, 1ul>) (functor=
    @0x188aa06d79c0: (void (google_apis::UrlFetchRequestBase::*)(google_apis::UrlFetchRequestBase * const, google_apis::DriveApiErrorCode)) 0x33b9950 <jingle_glue::JingleThreadWrapper::RunTask(int)>, bound=...) at ../../base/bind_internal.h:368
#21 0x000000000100598c in base::internal::Invoker<base::internal::BindState<void (google_apis::UrlFetchRequestBase::*)(google_apis::DriveApiErrorCode), base::WeakPtr<google_apis::UrlFetchRequestBase>, google_apis::DriveApiErrorCode>, void ()>::Run(base::internal::BindStateBase*) (
    base=0x188aa06d79a0) at ../../base/bind_internal.h:350
#22 0x00000000012647b1 in base::OnceCallback<void ()>::Run() && (this=0x7f7e6e9d9a68) at ../../base/callback.h:65
#23 0x0000000001d6457a in base::debug::TaskAnnotator::RunTask (this=0x188a9f7f0a68, queue_function=0x354f04 "MessageLoop::PostTask", 
    pending_task=0x7f7e6e9d9a68) at ../../base/debug/task_annotator.cc:55
#24 0x0000000001d5f2c9 in base::internal::IncomingTaskQueue::RunTask (this=0x188a9f7f0a20, pending_task=0x7f7e6e9d9a68)
    at ../../base/message_loop/incoming_task_queue.cc:128
#25 0x0000000001d5cb5e in base::MessageLoop::RunTask (this=0x7f7e6e9da558, pending_task=0x7f7e6e9d9a68)
    at ../../base/message_loop/message_loop.cc:391
#26 0x0000000001d5cdf8 in base::MessageLoop::DeferOrRunPendingTask (this=0x7f7e6e9da558, pending_task=...)
    at ../../base/message_loop/message_loop.cc:403
#27 0x0000000001d5d140 in base::MessageLoop::DoWork (this=0x7f7e6e9da558) at ../../base/message_loop/message_loop.cc:447
#28 0x0000000001d68079 in base::MessagePumpLibevent::Run (this=0x188a9fba95a0, delegate=0x7f7e6e9da558)
    at ../../base/message_loop/message_pump_libevent.cc:220
#29 0x0000000001d5c2f2 in base::MessageLoop::Run (this=0x7f7e6e9da558, application_tasks_allowed=true) at ../../base/message_loop/message_loop.cc:342
#30 0x0000000001ddbe90 in base::RunLoop::Run (this=0x7f7e6e9da4f8) at ../../base/run_loop.cc:130
#31 0x000000000106fff5 in remoting::AutoThread::ThreadMain (this=0x188a9f85a1a0) at ../../remoting/base/auto_thread.cc:227
#32 0x0000000001e69221 in base::(anonymous namespace)::ThreadFunc (params=0x188a9fa1ef70) at ../../base/threading/platform_thread_posix.cc:75
#33 0x00007f7e7cf53184 in start_thread (arg=0x7f7e6e9db700) at pthread_create.c:312
#34 0x00007f7e782dbffd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Comment 13 by hbos@chromium.org, Dec 29 2017

Whatever acts as the webrtc signaling thread has to allow sync primitives. Can you give the thread sync privileges or create a new thread that has them and async invoke the operations on that thread?
Looks like a separate thread for WebRTC signaling is the way to go. 
Project Member

Comment 15 by bugdroid1@chromium.org, Jan 4 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/dbc768f49253a591052907421eb51da84a5d3a91

commit dbc768f49253a591052907421eb51da84a5d3a91
Author: Joe Downing <joedow@chromium.org>
Date: Thu Jan 04 20:19:07 2018

Adding a workaround for WebRTC DCHECK

This change introduces a workaround and a TODO for the WebRTC DCHECK
that we have been manually working around.  We will continue to
work on the proper solution and remove this workaround once it is ready.

Note: I also updated the name of the method being commented out due to an
error that occurs during CL validation prior to uploading.

BUG=793486

Change-Id: Ibb77bf509f28698a4c3564c85386b6362a98daad
Reviewed-on: https://chromium-review.googlesource.com/850442
Commit-Queue: Lambros Lambrou <lambroslambrou@chromium.org>
Reviewed-by: Lambros Lambrou <lambroslambrou@chromium.org>
Cr-Commit-Position: refs/heads/master@{#527079}
[modify] https://crrev.com/dbc768f49253a591052907421eb51da84a5d3a91/remoting/host/chromoting_host_context.cc

Owner: joedow@chromium.org
Taking a look at this to help offload work from Lambros.
Cc: lambroslambrou@chromium.org

Sign in to add a comment