New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 665996 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
please use my google.com address
Closed: Nov 2016
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Mojo bindings: Lock order inversion between Connector and its Watcher on IO thread bindings

Project Member Reported by roc...@chromium.org, Nov 16 2016

Issue description

Test have been failing for a while on the Linux TSan Tests bot: https://build.chromium.org/p/chromium.memory.full/builders/Linux%20TSan%20Tests

content_browsertests fail with the following error:

WARNING: ThreadSanitizer: lock-order-inversion (potential deadlock) (pid=23850)
  Cycle in lock order graph: M2778 (0x7b140002d2e8) => M2772 (0x7b0c00030b10) => M2778

  Mutex M2772 acquired here while holding mutex M2778 in thread T12:
    #0 pthread_mutex_lock <null> (content_browsertests+0x0000004cc8be)
    #1 base::internal::LockImpl::Lock() base/synchronization/lock_impl_posix.cc:64:12 (content_browsertests+0x000002939605)
    #2 Acquire base/synchronization/lock.h:26:26 (content_browsertests+0x00000259487d)
    #3 MayAutoLock mojo/public/cpp/bindings/lib/may_auto_lock.h:17 (content_browsertests+0x00000259487d)
    #4 mojo::Connector::Accept(mojo::Message*) mojo/public/cpp/bindings/lib/connector.cc:121 (content_browsertests+0x00000259487d)
    #5 mojo::internal::MultiplexRouter::InterfaceEndpoint::SendMessage(mojo::Message*) mojo/public/cpp/bindings/lib/multiplex_router.cc:129:32 (content_browsertests+0x00000259f282)
    #6 mojo::InterfaceEndpointClient::Accept(mojo::Message*) mojo/public/cpp/bindings/lib/interface_endpoint_client.cc:218:23 (content_browsertests+0x00000259770f)
    #7 mojo::(anonymous namespace)::ResponderThunk::Accept(mojo::Message*) mojo/public/cpp/bindings/lib/interface_endpoint_client.cc:79:34 (content_browsertests+0x000002598271)
    #8 service_manager::mojom::Service_OnConnect_ProxyToResponder::Run() out/Release/gen/services/service_manager/public/interfaces/service.mojom.cc:343:25 (content_browsertests+0x000000ca6737)
    #9 Invoke<std::__1::unique_ptr<service_manager::mojom::Service_OnConnect_ProxyToResponder, std::__1::default_delete<service_manager::mojom::Service_OnConnect_ProxyToResponder> >> base/bind_internal.h:214:12 (content_browsertests+0x000000ca7b38)
    #10 MakeItSo<void (service_manager::mojom::Service_OnConnect_ProxyToResponder::*const &)(), std::__1::unique_ptr<service_manager::mojom::Service_OnConnect_ProxyToResponder, std::__1::default_delete<service_manager::mojom::Service_OnConnect_ProxyToResponder> > > base/bind_internal.h:285 (content_browsertests+0x000000ca7b38)
    #11 RunImpl<void (service_manager::mojom::Service_OnConnect_ProxyToResponder::*const &)(), const std::__1::tuple<base::internal::PassedWrapper<std::__1::unique_ptr<service_manager::mojom::Service_OnConnect_ProxyToResponder, std::__1::default_delete<service_manager::mojom::Service_OnConnect_ProxyToResponder> > > > &, 0> base/bind_internal.h:361 (content_browsertests+0x000000ca7b38)
    #12 base::internal::Invoker<base::internal::BindState<void (service_manager::mojom::Service_OnConnect_ProxyToResponder::*)(), base::internal::PassedWrapper<std::__1::unique_ptr<service_manager::mojom::Service_OnConnect_ProxyToResponder, std::__1::default_delete<service_manager::mojom::Service_OnConnect_ProxyToResponder> > > >, void ()>::Run(base::internal::BindStateBase*) base/bind_internal.h:339 (content_browsertests+0x000000ca7b38)
    #13 Run base/callback.h:64:12 (content_browsertests+0x000003ba148e)
    #14 service_manager::ServiceContext::OnConnect(service_manager::ServiceInfo const&, mojo::InterfaceRequest<service_manager::mojom::InterfaceProvider>, base::Callback<void (), (base::internal::CopyMode)1, (base::internal::RepeatMode)1> const&) services/service_manager/public/cpp/lib/service_context.cc:104 (content_browsertests+0x000003ba148e)
    #15 service_manager::mojom::ServiceStubDispatch::AcceptWithResponder(service_manager::mojom::Service*, mojo::internal::SerializationContext*, mojo::Message*, mojo::MessageReceiverWithStatus*) out/Release/gen/services/service_manager/public/interfaces/service.mojom.cc:440:13 (content_browsertests+0x000000ca6b3b)
    #16 service_manager::mojom::ServiceStub<mojo::RawPtrImplRefTraits<service_manager::mojom::Service> >::AcceptWithResponder(mojo::Message*, mojo::MessageReceiverWithStatus*) out/Release/gen/services/service_manager/public/interfaces/service.mojom.h:158:12 (content_browsertests+0x000003ba1aaf)
    #17 mojo::InterfaceEndpointClient::HandleValidatedMessage(mojo::Message*) mojo/public/cpp/bindings/lib/interface_endpoint_client.cc:314:32 (content_browsertests+0x000002596d41)
    #18 mojo::InterfaceEndpointClient::HandleIncomingMessageThunk::Accept(mojo::Message*) mojo/public/cpp/bindings/lib/interface_endpoint_client.cc:128:18 (content_browsertests+0x000002596b0a)
    #19 mojo::FilterChain::Accept(mojo::Message*) mojo/public/cpp/bindings/lib/filter_chain.cc:40:17 (content_browsertests+0x00000259657d)
    #20 mojo::InterfaceEndpointClient::HandleIncomingMessage(mojo::Message*) mojo/public/cpp/bindings/lib/interface_endpoint_client.cc:273:19 (content_browsertests+0x000002597c64)
    #21 mojo::internal::MultiplexRouter::ProcessIncomingMessage(mojo::Message*, mojo::internal::MultiplexRouter::ClientCallBehavior, base::SingleThreadTaskRunner*) mojo/public/cpp/bindings/lib/multiplex_router.cc:829:22 (content_browsertests+0x00000259ddec)
    #22 mojo::internal::MultiplexRouter::Accept(mojo::Message*) mojo/public/cpp/bindings/lib/multiplex_router.cc:539:25 (content_browsertests+0x00000259d6c5)
    #23 mojo::FilterChain::Accept(mojo::Message*) mojo/public/cpp/bindings/lib/filter_chain.cc:40:17 (content_browsertests+0x00000259657d)
    #24 mojo::Connector::ReadSingleMessage(unsigned int*) mojo/public/cpp/bindings/lib/connector.cc:247:51 (content_browsertests+0x000002594775)
    #25 ReadAllAvailableMessages mojo/public/cpp/bindings/lib/connector.cc:272:10 (content_browsertests+0x000002594b87)
    #26 OnHandleReadyInternal mojo/public/cpp/bindings/lib/connector.cc:205 (content_browsertests+0x000002594b87)
    #27 mojo::Connector::OnWatcherHandleReady(unsigned int) mojo/public/cpp/bindings/lib/connector.cc:183 (content_browsertests+0x000002594b87)
    #28 Invoke<mojo::Connector *, unsigned int> base/bind_internal.h:214:12 (content_browsertests+0x000002594d34)
    #29 MakeItSo<void (mojo::Connector::*const &)(unsigned int), mojo::Connector *, unsigned int> base/bind_internal.h:285 (content_browsertests+0x000002594d34)
    #30 RunImpl<void (mojo::Connector::*const &)(unsigned int), const std::__1::tuple<base::internal::UnretainedWrapper<mojo::Connector> > &, 0> base/bind_internal.h:361 (content_browsertests+0x000002594d34)
    #31 base::internal::Invoker<base::internal::BindState<void (mojo::Connector::*)(unsigned int), base::internal::UnretainedWrapper<mojo::Connector> >, void (unsigned int)>::Run(base::internal::BindStateBase*, unsigned int&&) base/bind_internal.h:339 (content_browsertests+0x000002594d34)
    #32 Run base/callback.h:64:12 (content_browsertests+0x000002b93229)
    #33 OnHandleReady mojo/public/cpp/system/watcher.cc:122 (content_browsertests+0x000002b93229)
    #34 mojo::Watcher::CallOnHandleReady(unsigned long, unsigned int, MojoHandleSignalsState, unsigned int) mojo/public/cpp/system/watcher.cc:142 (content_browsertests+0x000002b93229)
    #35 mojo::edk::(anonymous namespace)::CallWatchCallback(void (*)(unsigned long, unsigned int, MojoHandleSignalsState, unsigned int), unsigned long, unsigned int, mojo::edk::HandleSignalsState const&, unsigned int) mojo/edk/system/core.cc:57:3 (content_browsertests+0x000002559ebc)
    #36 Invoke<void (*const &)(unsigned long, unsigned int, MojoHandleSignalsState, unsigned int), const unsigned long &, unsigned int, const mojo::edk::HandleSignalsState &, unsigned int> base/bind_internal.h:164:12 (content_browsertests+0x00000255e60d)
    #37 MakeItSo<void (*const &)(void (*)(unsigned long, unsigned int, MojoHandleSignalsState, unsigned int), unsigned long, unsigned int, const mojo::edk::HandleSignalsState &, unsigned int), void (*const &)(unsigned long, unsigned int, MojoHandleSignalsState, unsigned int), const unsigned long &, unsigned int, const mojo::edk::HandleSignalsState &, unsigned int> base/bind_internal.h:285 (content_browsertests+0x00000255e60d)
    #38 RunImpl<void (*const &)(void (*)(unsigned long, unsigned int, MojoHandleSignalsState, unsigned int), unsigned long, unsigned int, const mojo::edk::HandleSignalsState &, unsigned int), const std::__1::tuple<void (*)(unsigned long, unsigned int, MojoHandleSignalsState, unsigned int), unsigned long> &, 0, 1> base/bind_internal.h:361 (content_browsertests+0x00000255e60d)
    #39 base::internal::Invoker<base::internal::BindState<void (*)(void (*)(unsigned long, unsigned int, MojoHandleSignalsState, unsigned int), unsigned long, unsigned int, mojo::edk::HandleSignalsState const&, unsigned int), void (*)(unsigned long, unsigned int, MojoHandleSignalsState, unsigned int), unsigned long>, void (unsigned int, mojo::edk::HandleSignalsState const&, unsigned int)>::Run(base::internal::BindStateBase*, unsigned int&&, mojo::edk::HandleSignalsState const&, unsigned int&&) base/bind_internal.h:339 (content_browsertests+0x00000255e60d)
    #40 Run base/callback.h:64:12 (content_browsertests+0x000002585c89)
    #41 mojo::edk::Watcher::MaybeInvokeCallback(unsigned int, mojo::edk::HandleSignalsState const&, unsigned int) mojo/edk/system/watcher.cc:24 (content_browsertests+0x000002585c89)
    #42 mojo::edk::RequestContext::~RequestContext() mojo/edk/system/request_context.cc:59:22 (content_browsertests+0x00000257d068)
    #43 mojo::edk::RequestContext::~RequestContext() mojo/edk/system/request_context.cc:60:5 (content_browsertests+0x00000257d073)
    #44 mojo::edk::NodeChannel::OnChannelMessage(void const*, unsigned long, std::__1::unique_ptr<std::__1::vector<mojo::edk::PlatformHandle, std::__1::allocator<mojo::edk::PlatformHandle> >, mojo::edk::PlatformHandleVectorDeleter>) mojo/edk/system/node_channel.cc:766:1 (content_browsertests+0x000002590c90)
    #45 mojo::edk::Channel::OnReadComplete(unsigned long, unsigned long*) mojo/edk/system/channel.cc:563:18 (content_browsertests+0x00000258984b)
    #46 mojo::edk::(anonymous namespace)::ChannelPosix::OnFileCanReadWithoutBlocking(int) mojo/edk/system/channel_posix.cc:314:14 (content_browsertests+0x00000258bcee)
    #47 non-virtual thunk to mojo::edk::(anonymous namespace)::ChannelPosix::OnFileCanReadWithoutBlocking(int) mojo/edk/system/channel_posix.cc:274:8 (content_browsertests+0x00000258bf54)
    #48 OnFileCanReadWithoutBlocking base/message_loop/message_pump_libevent.cc:96:13 (content_browsertests+0x0000028fe484)
    #49 base::MessagePumpLibevent::OnLibeventNotification(int, short, void*) base/message_loop/message_pump_libevent.cc:337 (content_browsertests+0x0000028fe484)
    #50 event_process_active base/third_party/libevent/event.c:381:4 (content_browsertests+0x0000029a5695)
    #51 event_base_loop base/third_party/libevent/event.c:521 (content_browsertests+0x0000029a5695)
    #52 base::MessagePumpLibevent::Run(base::MessagePump::Delegate*) base/message_loop/message_pump_libevent.cc:222:5 (content_browsertests+0x0000028fe688)
    #53 base::MessageLoop::RunHandler() base/message_loop/message_loop.cc:378:10 (content_browsertests+0x0000028f84cb)
    #54 base::RunLoop::Run() base/run_loop.cc:35:10 (content_browsertests+0x0000029237d9)
    #55 base::Thread::Run(base::RunLoop*) base/threading/thread.cc:245:13 (content_browsertests+0x000002950849)
    #56 content::BrowserThreadImpl::IOThreadRun(base::RunLoop*) content/browser/browser_thread_impl.cc:253:11 (content_browsertests+0x000001e13dcf)
    #57 content::BrowserThreadImpl::Run(base::RunLoop*) content/browser/browser_thread_impl.cc:288:14 (content_browsertests+0x000001e13ff2)
    #58 base::Thread::ThreadMain() base/threading/thread.cc:333:3 (content_browsertests+0x000002950aa4)
    #59 base::(anonymous namespace)::ThreadFunc(void*) base/threading/platform_thread_posix.cc:71:13 (content_browsertests+0x000002949e8d)

  Mutex M2778 previously acquired by the same thread here:
    #0 pthread_mutex_lock <null> (content_browsertests+0x0000004cc8be)
    #1 base::internal::LockImpl::Lock() base/synchronization/lock_impl_posix.cc:64:12 (content_browsertests+0x000002939605)
    #2 Acquire base/synchronization/lock.h:26:26 (content_browsertests+0x000002585c31)
    #3 AutoLock base/synchronization/lock.h:115 (content_browsertests+0x000002585c31)
    #4 mojo::edk::Watcher::MaybeInvokeCallback(unsigned int, mojo::edk::HandleSignalsState const&, unsigned int) mojo/edk/system/watcher.cc:20 (content_browsertests+0x000002585c31)
    #5 mojo::edk::RequestContext::~RequestContext() mojo/edk/system/request_context.cc:59:22 (content_browsertests+0x00000257d068)
    #6 mojo::edk::RequestContext::~RequestContext() mojo/edk/system/request_context.cc:60:5 (content_browsertests+0x00000257d073)
    #7 mojo::edk::NodeChannel::OnChannelMessage(void const*, unsigned long, std::__1::unique_ptr<std::__1::vector<mojo::edk::PlatformHandle, std::__1::allocator<mojo::edk::PlatformHandle> >, mojo::edk::PlatformHandleVectorDeleter>) mojo/edk/system/node_channel.cc:766:1 (content_browsertests+0x000002590c90)
    #8 mojo::edk::Channel::OnReadComplete(unsigned long, unsigned long*) mojo/edk/system/channel.cc:563:18 (content_browsertests+0x00000258984b)
    #9 mojo::edk::(anonymous namespace)::ChannelPosix::OnFileCanReadWithoutBlocking(int) mojo/edk/system/channel_posix.cc:314:14 (content_browsertests+0x00000258bcee)
    #10 non-virtual thunk to mojo::edk::(anonymous namespace)::ChannelPosix::OnFileCanReadWithoutBlocking(int) mojo/edk/system/channel_posix.cc:274:8 (content_browsertests+0x00000258bf54)
    #11 OnFileCanReadWithoutBlocking base/message_loop/message_pump_libevent.cc:96:13 (content_browsertests+0x0000028fe484)
    #12 base::MessagePumpLibevent::OnLibeventNotification(int, short, void*) base/message_loop/message_pump_libevent.cc:337 (content_browsertests+0x0000028fe484)
    #13 event_process_active base/third_party/libevent/event.c:381:4 (content_browsertests+0x0000029a5695)
    #14 event_base_loop base/third_party/libevent/event.c:521 (content_browsertests+0x0000029a5695)
    #15 base::MessagePumpLibevent::Run(base::MessagePump::Delegate*) base/message_loop/message_pump_libevent.cc:222:5 (content_browsertests+0x0000028fe688)
    #16 base::MessageLoop::RunHandler() base/message_loop/message_loop.cc:378:10 (content_browsertests+0x0000028f84cb)
    #17 base::RunLoop::Run() base/run_loop.cc:35:10 (content_browsertests+0x0000029237d9)
    #18 base::Thread::Run(base::RunLoop*) base/threading/thread.cc:245:13 (content_browsertests+0x000002950849)
    #19 content::BrowserThreadImpl::IOThreadRun(base::RunLoop*) content/browser/browser_thread_impl.cc:253:11 (content_browsertests+0x000001e13dcf)
    #20 content::BrowserThreadImpl::Run(base::RunLoop*) content/browser/browser_thread_impl.cc:288:14 (content_browsertests+0x000001e13ff2)
    #21 base::Thread::ThreadMain() base/threading/thread.cc:333:3 (content_browsertests+0x000002950aa4)
    #22 base::(anonymous namespace)::ThreadFunc(void*) base/threading/platform_thread_posix.cc:71:13 (content_browsertests+0x000002949e8d)

  Mutex M2778 acquired here while holding mutex M2772 in thread T12:
    #0 pthread_mutex_lock <null> (content_browsertests+0x0000004cc8be)
    #1 base::internal::LockImpl::Lock() base/synchronization/lock_impl_posix.cc:64:12 (content_browsertests+0x000002939605)
    #2 Acquire base/synchronization/lock.h:26:26 (content_browsertests+0x000002585c31)
    #3 AutoLock base/synchronization/lock.h:115 (content_browsertests+0x000002585c31)
    #4 mojo::edk::Watcher::MaybeInvokeCallback(unsigned int, mojo::edk::HandleSignalsState const&, unsigned int) mojo/edk/system/watcher.cc:20 (content_browsertests+0x000002585c31)
    #5 mojo::edk::RequestContext::~RequestContext() mojo/edk/system/request_context.cc:59:22 (content_browsertests+0x00000257d068)
    #6 mojo::edk::Core::WriteMessageNew(unsigned int, unsigned long, unsigned int) mojo/edk/system/core.cc:702:1 (content_browsertests+0x00000255bc46)
    #7 MojoWriteMessageNewImpl mojo/edk/embedder/entrypoints.cc:120:18 (content_browsertests+0x000000e1354c)
    #8 MojoWriteMessageNew mojo/public/c/system/thunks.cc:210:10 (content_browsertests+0x000002b93ee4)
    #9 WriteMessageNew mojo/public/cpp/system/message_pipe.h:97:10 (content_browsertests+0x000002594917)
    #10 mojo::Connector::Accept(mojo::Message*) mojo/public/cpp/bindings/lib/connector.cc:127 (content_browsertests+0x000002594917)
    #11 mojo::(anonymous namespace)::SendRunOrClosePipeMessage(mojo::MessageReceiver*, mojo::StructPtr<mojo::pipe_control::RunOrClosePipeInput>, mojo::internal::SerializationContext*) mojo/public/cpp/bindings/lib/pipe_control_message_proxy.cc:36:23 (content_browsertests+0x0000025a46fa)
    #12 mojo::PipeControlMessageProxy::NotifyPeerEndpointClosed(unsigned int) mojo/public/cpp/bindings/lib/pipe_control_message_proxy.cc:58:3 (content_browsertests+0x0000025a44e0)
    #13 mojo::internal::MultiplexRouter::CloseEndpointHandle(unsigned int, bool) mojo/public/cpp/bindings/lib/multiplex_router.cc:419:28 (content_browsertests+0x00000259c70a)
    #14 non-virtual thunk to mojo::internal::MultiplexRouter::CloseEndpointHandle(unsigned int, bool) mojo/public/cpp/bindings/lib/multiplex_router.cc:394:23 (content_browsertests+0x00000259ce5e)
    #15 reset mojo/public/cpp/bindings/lib/scoped_interface_endpoint_handle.cc:38:22 (content_browsertests+0x0000025a4c8b)
    #16 mojo::ScopedInterfaceEndpointHandle::~ScopedInterfaceEndpointHandle() mojo/public/cpp/bindings/lib/scoped_interface_endpoint_handle.cc:23 (content_browsertests+0x0000025a4c8b)
    #17 mojo::InterfaceEndpointClient::~InterfaceEndpointClient() mojo/public/cpp/bindings/lib/interface_endpoint_client.cc:173:1 (content_browsertests+0x00000259745d)
    #18 mojo::InterfaceEndpointClient::~InterfaceEndpointClient() mojo/public/cpp/bindings/lib/interface_endpoint_client.cc:166:53 (content_browsertests+0x0000025974c9)
    #19 operator() buildtools/third_party/libc++/trunk/include/memory:2529:13 (content_browsertests+0x000003ba0db4)
    #20 reset buildtools/third_party/libc++/trunk/include/memory:2735 (content_browsertests+0x000003ba0db4)
    #21 ~AssociatedInterfacePtrState mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h:41 (content_browsertests+0x000003ba0db4)
    #22 ~AssociatedInterfacePtr mojo/public/cpp/bindings/associated_interface_ptr.h:55 (content_browsertests+0x000003ba0db4)
    #23 service_manager::ServiceContext::~ServiceContext() services/service_manager/public/cpp/lib/service_context.cc:45 (content_browsertests+0x000003ba0db4)
    #24 service_manager::ServiceContext::~ServiceContext() services/service_manager/public/cpp/lib/service_context.cc:45:35 (content_browsertests+0x000003ba0f39)
    #25 operator() buildtools/third_party/libc++/trunk/include/memory:2529:13 (content_browsertests+0x000000b09916)
    #26 reset buildtools/third_party/libc++/trunk/include/memory:2735 (content_browsertests+0x000000b09916)
    #27 content::ServiceManagerConnectionImpl::IOThreadContext::ShutDownOnIOThread() content/common/service_manager/service_manager_connection_impl.cc:201 (content_browsertests+0x000000b09916)
    #28 Invoke<const scoped_refptr<content::ServiceManagerConnectionImpl::IOThreadContext> &> base/bind_internal.h:214:12 (content_browsertests+0x000000b08a06)
    #29 MakeItSo<void (content::ServiceManagerConnectionImpl::IOThreadContext::*const &)(), const scoped_refptr<content::ServiceManagerConnectionImpl::IOThreadContext> &> base/bind_internal.h:285 (content_browsertests+0x000000b08a06)
    #30 RunImpl<void (content::ServiceManagerConnectionImpl::IOThreadContext::*const &)(), const std::__1::tuple<scoped_refptr<content::ServiceManagerConnectionImpl::IOThreadContext> > &, 0> base/bind_internal.h:361 (content_browsertests+0x000000b08a06)
    #31 base::internal::Invoker<base::internal::BindState<void (content::ServiceManagerConnectionImpl::IOThreadContext::*)(), scoped_refptr<content::ServiceManagerConnectionImpl::IOThreadContext> >, void ()>::Run(base::internal::BindStateBase*) base/bind_internal.h:339 (content_browsertests+0x000000b08a06)
    #32 Run base/callback.h:47:12 (content_browsertests+0x000002993095)
    #33 base::debug::TaskAnnotator::RunTask(char const*, base::PendingTask*) base/debug/task_annotator.cc:52 (content_browsertests+0x000002993095)
    #34 base::MessageLoop::RunTask(base::PendingTask*) base/message_loop/message_loop.cc:413:19 (content_browsertests+0x0000028f88e9)
    #35 base::MessageLoop::DeferOrRunPendingTask(base::PendingTask) base/message_loop/message_loop.cc:422:5 (content_browsertests+0x0000028f8ded)
    #36 base::MessageLoop::DoWork() base/message_loop/message_loop.cc:515:13 (content_browsertests+0x0000028f9504)
    #37 base::MessagePumpLibevent::Run(base::MessagePump::Delegate*) base/message_loop/message_pump_libevent.cc:218:31 (content_browsertests+0x0000028fe850)
    #38 base::MessageLoop::RunHandler() base/message_loop/message_loop.cc:378:10 (content_browsertests+0x0000028f84cb)
    #39 base::RunLoop::Run() base/run_loop.cc:35:10 (content_browsertests+0x0000029237d9)
    #40 base::Thread::Run(base::RunLoop*) base/threading/thread.cc:245:13 (content_browsertests+0x000002950849)
    #41 content::BrowserThreadImpl::IOThreadRun(base::RunLoop*) content/browser/browser_thread_impl.cc:253:11 (content_browsertests+0x000001e13dcf)
    #42 content::BrowserThreadImpl::Run(base::RunLoop*) content/browser/browser_thread_impl.cc:288:14 (content_browsertests+0x000001e13ff2)
    #43 base::Thread::ThreadMain() base/threading/thread.cc:333:3 (content_browsertests+0x000002950aa4)
    #44 base::(anonymous namespace)::ThreadFunc(void*) base/threading/platform_thread_posix.cc:71:13 (content_browsertests+0x000002949e8d)

  Mutex M2772 previously acquired by the same thread here:
    #0 pthread_mutex_lock <null> (content_browsertests+0x0000004cc8be)
    #1 base::internal::LockImpl::Lock() base/synchronization/lock_impl_posix.cc:64:12 (content_browsertests+0x000002939605)
    #2 Acquire base/synchronization/lock.h:26:26 (content_browsertests+0x00000259487d)
    #3 MayAutoLock mojo/public/cpp/bindings/lib/may_auto_lock.h:17 (content_browsertests+0x00000259487d)
    #4 mojo::Connector::Accept(mojo::Message*) mojo/public/cpp/bindings/lib/connector.cc:121 (content_browsertests+0x00000259487d)
    #5 mojo::(anonymous namespace)::SendRunOrClosePipeMessage(mojo::MessageReceiver*, mojo::StructPtr<mojo::pipe_control::RunOrClosePipeInput>, mojo::internal::SerializationContext*) mojo/public/cpp/bindings/lib/pipe_control_message_proxy.cc:36:23 (content_browsertests+0x0000025a46fa)
    #6 mojo::PipeControlMessageProxy::NotifyPeerEndpointClosed(unsigned int) mojo/public/cpp/bindings/lib/pipe_control_message_proxy.cc:58:3 (content_browsertests+0x0000025a44e0)
    #7 mojo::internal::MultiplexRouter::CloseEndpointHandle(unsigned int, bool) mojo/public/cpp/bindings/lib/multiplex_router.cc:419:28 (content_browsertests+0x00000259c70a)
    #8 non-virtual thunk to mojo::internal::MultiplexRouter::CloseEndpointHandle(unsigned int, bool) mojo/public/cpp/bindings/lib/multiplex_router.cc:394:23 (content_browsertests+0x00000259ce5e)
    #9 reset mojo/public/cpp/bindings/lib/scoped_interface_endpoint_handle.cc:38:22 (content_browsertests+0x0000025a4c8b)
    #10 mojo::ScopedInterfaceEndpointHandle::~ScopedInterfaceEndpointHandle() mojo/public/cpp/bindings/lib/scoped_interface_endpoint_handle.cc:23 (content_browsertests+0x0000025a4c8b)
    #11 mojo::InterfaceEndpointClient::~InterfaceEndpointClient() mojo/public/cpp/bindings/lib/interface_endpoint_client.cc:173:1 (content_browsertests+0x00000259745d)
    #12 mojo::InterfaceEndpointClient::~InterfaceEndpointClient() mojo/public/cpp/bindings/lib/interface_endpoint_client.cc:166:53 (content_browsertests+0x0000025974c9)
    #13 operator() buildtools/third_party/libc++/trunk/include/memory:2529:13 (content_browsertests+0x000003ba0db4)
    #14 reset buildtools/third_party/libc++/trunk/include/memory:2735 (content_browsertests+0x000003ba0db4)
    #15 ~AssociatedInterfacePtrState mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h:41 (content_browsertests+0x000003ba0db4)
    #16 ~AssociatedInterfacePtr mojo/public/cpp/bindings/associated_interface_ptr.h:55 (content_browsertests+0x000003ba0db4)
    #17 service_manager::ServiceContext::~ServiceContext() services/service_manager/public/cpp/lib/service_context.cc:45 (content_browsertests+0x000003ba0db4)
    #18 service_manager::ServiceContext::~ServiceContext() services/service_manager/public/cpp/lib/service_context.cc:45:35 (content_browsertests+0x000003ba0f39)
    #19 operator() buildtools/third_party/libc++/trunk/include/memory:2529:13 (content_browsertests+0x000000b09916)
    #20 reset buildtools/third_party/libc++/trunk/include/memory:2735 (content_browsertests+0x000000b09916)
    #21 content::ServiceManagerConnectionImpl::IOThreadContext::ShutDownOnIOThread() content/common/service_manager/service_manager_connection_impl.cc:201 (content_browsertests+0x000000b09916)
    #22 Invoke<const scoped_refptr<content::ServiceManagerConnectionImpl::IOThreadContext> &> base/bind_internal.h:214:12 (content_browsertests+0x000000b08a06)
    #23 MakeItSo<void (content::ServiceManagerConnectionImpl::IOThreadContext::*const &)(), const scoped_refptr<content::ServiceManagerConnectionImpl::IOThreadContext> &> base/bind_internal.h:285 (content_browsertests+0x000000b08a06)
    #24 RunImpl<void (content::ServiceManagerConnectionImpl::IOThreadContext::*const &)(), const std::__1::tuple<scoped_refptr<content::ServiceManagerConnectionImpl::IOThreadContext> > &, 0> base/bind_internal.h:361 (content_browsertests+0x000000b08a06)
    #25 base::internal::Invoker<base::internal::BindState<void (content::ServiceManagerConnectionImpl::IOThreadContext::*)(), scoped_refptr<content::ServiceManagerConnectionImpl::IOThreadContext> >, void ()>::Run(base::internal::BindStateBase*) base/bind_internal.h:339 (content_browsertests+0x000000b08a06)
    #26 Run base/callback.h:47:12 (content_browsertests+0x000002993095)
    #27 base::debug::TaskAnnotator::RunTask(char const*, base::PendingTask*) base/debug/task_annotator.cc:52 (content_browsertests+0x000002993095)
    #28 base::MessageLoop::RunTask(base::PendingTask*) base/message_loop/message_loop.cc:413:19 (content_browsertests+0x0000028f88e9)
    #29 base::MessageLoop::DeferOrRunPendingTask(base::PendingTask) base/message_loop/message_loop.cc:422:5 (content_browsertests+0x0000028f8ded)
    #30 base::MessageLoop::DoWork() base/message_loop/message_loop.cc:515:13 (content_browsertests+0x0000028f9504)
    #31 base::MessagePumpLibevent::Run(base::MessagePump::Delegate*) base/message_loop/message_pump_libevent.cc:218:31 (content_browsertests+0x0000028fe850)
    #32 base::MessageLoop::RunHandler() base/message_loop/message_loop.cc:378:10 (content_browsertests+0x0000028f84cb)
    #33 base::RunLoop::Run() base/run_loop.cc:35:10 (content_browsertests+0x0000029237d9)
    #34 base::Thread::Run(base::RunLoop*) base/threading/thread.cc:245:13 (content_browsertests+0x000002950849)
    #35 content::BrowserThreadImpl::IOThreadRun(base::RunLoop*) content/browser/browser_thread_impl.cc:253:11 (content_browsertests+0x000001e13dcf)
    #36 content::BrowserThreadImpl::Run(base::RunLoop*) content/browser/browser_thread_impl.cc:288:14 (content_browsertests+0x000001e13ff2)
    #37 base::Thread::ThreadMain() base/threading/thread.cc:333:3 (content_browsertests+0x000002950aa4)
    #38 base::(anonymous namespace)::ThreadFunc(void*) base/threading/platform_thread_posix.cc:71:13 (content_browsertests+0x000002949e8d)

  Thread T12 'Chrome_IOThread' (tid=23925, running) created by main thread at:
    #0 pthread_create <null> (content_browsertests+0x0000004b3875)
    #1 base::(anonymous namespace)::CreateThread(unsigned long, bool, base::PlatformThread::Delegate*, base::PlatformThreadHandle*, base::ThreadPriority) base/threading/platform_thread_posix.cc:110:13 (content_browsertests+0x000002949b57)
    #2 base::PlatformThread::CreateWithPriority(unsigned long, base::PlatformThread::Delegate*, base::PlatformThreadHandle*, base::ThreadPriority) base/threading/platform_thread_posix.cc:191:10 (content_browsertests+0x000002949a55)
    #3 base::Thread::StartWithOptions(base::Thread::Options const&) base/threading/thread.cc:112:15 (content_browsertests+0x0000029503a7)
    #4 content::BrowserThreadImpl::StartWithOptions(base::Thread::Options const&) content/browser/browser_thread_impl.cc:359:25 (content_browsertests+0x000001e14514)
    #5 content::BrowserMainLoop::CreateThreads() content/browser/browser_main_loop.cc:944:32 (content_browsertests+0x000001e0176a)
    #6 Invoke<content::BrowserMainLoop *> base/bind_internal.h:214:12 (content_browsertests+0x000001e06165)
    #7 MakeItSo<int (content::BrowserMainLoop::*const &)(), content::BrowserMainLoop *> base/bind_internal.h:285 (content_browsertests+0x000001e06165)
    #8 RunImpl<int (content::BrowserMainLoop::*const &)(), const std::__1::tuple<base::internal::UnretainedWrapper<content::BrowserMainLoop> > &, 0> base/bind_internal.h:361 (content_browsertests+0x000001e06165)
    #9 base::internal::Invoker<base::internal::BindState<int (content::BrowserMainLoop::*)(), base::internal::UnretainedWrapper<content::BrowserMainLoop> >, int ()>::Run(base::internal::BindStateBase*) base/bind_internal.h:339 (content_browsertests+0x000001e06165)
    #10 Run base/callback.h:64:12 (content_browsertests+0x00000228a0aa)
    #11 content::StartupTaskRunner::RunAllTasksNow() content/browser/startup_task_runner.cc:45 (content_browsertests+0x00000228a0aa)
    #12 content::BrowserMainLoop::CreateStartupTasks() content/browser/browser_main_loop.cc:852:25 (content_browsertests+0x000001e00c78)
    #13 content::BrowserMainRunnerImpl::Initialize(content::MainFunctionParams const&) content/browser/browser_main_runner.cc:126:17 (content_browsertests+0x000001e06af2)
    #14 ShellBrowserMain(content::MainFunctionParams const&, std::__1::unique_ptr<content::BrowserMainRunner, std::__1::default_delete<content::BrowserMainRunner> > const&) content/shell/browser/shell_browser_main.cc:23:32 (content_browsertests+0x0000024ce737)
    #15 content::ShellMainDelegate::RunProcess(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, content::MainFunctionParams const&) content/shell/app/shell_main_delegate.cc:293:16 (content_browsertests+0x0000024c1a33)
    #16 content::RunNamedProcessTypeMain(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, content::MainFunctionParams const&, content::ContentMainDelegate*) content/app/content_main_runner.cc:395:35 (content_browsertests+0x000001d2362b)
    #17 content::ContentMainRunnerImpl::Run() content/app/content_main_runner.cc:774:12 (content_browsertests+0x000001d24307)
    #18 content::ContentMain(content::ContentMainParams const&) content/app/content_main.cc:20:28 (content_browsertests+0x000001d1b5fe)
    #19 content::BrowserTestBase::SetUp() content/public/test/browser_test_base.cc:308:3 (content_browsertests+0x00000247124b)
    #20 content::ContentBrowserTest::SetUp() content/public/test/content_browser_test.cc:94:20 (content_browsertests+0x00000246ae36)
    #21 HandleExceptionsInMethodIfSupported<testing::Test, void> testing/gtest/src/gtest.cc:2458:12 (content_browsertests+0x00000267e49d)
    #22 testing::Test::Run() testing/gtest/src/gtest.cc:2470 (content_browsertests+0x00000267e49d)
    #23 testing::TestInfo::Run() testing/gtest/src/gtest.cc:2656:11 (content_browsertests+0x00000267f62d)
    #24 testing::TestCase::Run() testing/gtest/src/gtest.cc:2774:28 (content_browsertests+0x00000267ff06)
    #25 testing::internal::UnitTestImpl::RunAllTests() testing/gtest/src/gtest.cc:4647:43 (content_browsertests+0x0000026893e6)
    #26 HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool> testing/gtest/src/gtest.cc:2458:12 (content_browsertests+0x000002688d89)
    #27 testing::UnitTest::Run() testing/gtest/src/gtest.cc:4255 (content_browsertests+0x000002688d89)
    #28 RUN_ALL_TESTS testing/gtest/include/gtest/gtest.h:2237:46 (content_browsertests+0x00000249db59)
    #29 base::TestSuite::Run() base/test/test_suite.cc:246 (content_browsertests+0x00000249db59)
    #30 content::ContentTestLauncherDelegate::RunTestSuite(int, char**) content/test/content_test_launcher.cc:105:48 (content_browsertests+0x00000247050b)
    #31 content::LaunchTests(content::TestLauncherDelegate*, int, int, char**) content/public/test/test_launcher.cc:520:31 (content_browsertests+0x00000248af24)
    #32 main content/test/content_test_launcher.cc:131:10 (content_browsertests+0x000002470492)

 
Project Member

Comment 1 by bugdroid1@chromium.org, Nov 17 2016

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

commit 74279d49e257153aaac8b9362473c2a5d789dfd8
Author: rockot <rockot@chromium.org>
Date: Thu Nov 17 04:22:28 2016

Mojo EDK: Never notify own watchers within public API calls

Watcher notification requires a lock to be held, and arbitrary user
code may be invoked while within that stack. As such we should never
wake up a message pipe's own watcher from within a public API call
on that pipe's handle.

This removes such notifications from ReadMessage and WriteMessage.
The notifications are entirely redundant anyway, since they will have
already been triggered by OnPortStatusChanged when the underlying port
was closed.

BUG= 665996 
R=yzshen@chromium.org

Review-Url: https://codereview.chromium.org/2505263002
Cr-Commit-Position: refs/heads/master@{#432739}

[modify] https://crrev.com/74279d49e257153aaac8b9362473c2a5d789dfd8/mojo/edk/system/message_pipe_dispatcher.cc

Comment 2 by roc...@chromium.org, Nov 17 2016

Status: Fixed (was: Assigned)

Sign in to add a comment