[Webkit-unassigned] [Bug 181763] New: Possible deadlock when terminating a worker

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jan 17 13:56:43 PST 2018


https://bugs.webkit.org/show_bug.cgi?id=181763

            Bug ID: 181763
           Summary: Possible deadlock when terminating a worker
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Service Workers
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: cdumez at apple.com

Deadlock:

Main thread:
    2778 Thread_12836086   DispatchQueue_1: com.apple.main-thread  (serial)
    + 2778 start  (in libdyld.dylib) + 1  [0x7fff64e21115]
    +   2778 main  (in com.apple.WebKit.WebContent.Development) + 1195  [0x10a36513b]  XPCServiceMain.mm:148
    +     2778 xpc_main  (in libxpc.dylib) + 417  [0x7fff650ed082]
    +       2778 _xpc_objc_main  (in libxpc.dylib) + 580  [0x7fff650ee42f]
    +         2778 NSApplicationMain  (in AppKit) + 804  [0x7fff3a932f1a]
    +           2778 -[NSApplication run]  (in AppKit) + 764  [0x7fff3a963d6d]
    +             2778 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]  (in AppKit) + 3044  [0x7fff3b104b4c]
    +               2778 _DPSNextEvent  (in AppKit) + 2085  [0x7fff3a96ef5f]
    +                 2778 _BlockUntilNextEventMatchingListInModeWithFilter  (in HIToolbox) + 64  [0x7fff3c6a3914]
    +                   2778 ReceiveNextEventCommon  (in HIToolbox) + 613  [0x7fff3c6a3b96]
    +                     2778 RunCurrentEventLoopInMode  (in HIToolbox) + 286  [0x7fff3c6a3e26]
    +                       2778 CFRunLoopRunSpecific  (in CoreFoundation) + 487  [0x7fff3d3963d7]
    +                         2778 __CFRunLoopRun  (in CoreFoundation) + 1293  [0x7fff3d396b7d]
    +                           2778 __CFRunLoopDoSources0  (in CoreFoundation) + 208  [0x7fff3d397700]
    +                             2778 __CFRunLoopDoSource0  (in CoreFoundation) + 108  [0x7fff3d46c39c]
    +                               2778 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__  (in CoreFoundation) + 17  [0x7fff3d3b4711]
    +                                 2778 WTF::RunLoop::performWork(void*)  (in JavaScriptCore) + 36  [0x7a865a074]  RunLoopCF.cpp:38
    +                                   2778 WTF::RunLoop::performWork()  (in JavaScriptCore) + 445  [0x7a86598bd]  RunLoop.cpp:123
    +                                     2778 WTF::Function<void ()>::operator()() const  (in JavaScriptCore) + 139  [0x7a86148fb]  Function.h:56
    +                                       2778 WTF::Function<void ()>::CallableWrapper<IPC::Connection::enqueueIncomingMessage(std::__1::unique_ptr<IPC::Decoder, std::__1::default_delete<IPC::Decoder> >)::$_14>::call()  (in WebKit) + 25  [0x10a4de459]  Function.h:101
    +                                         2778 IPC::Connection::enqueueIncomingMessage(std::__1::unique_ptr<IPC::Decoder, std::__1::default_delete<IPC::Decoder> >)::$_14::operator()()  (in WebKit) + 29  [0x10a4de4fd]  Connection.cpp:895
    +                                           2778 IPC::Connection::dispatchOneMessage()  (in WebKit) + 1530  [0x10a4c603a]  Connection.cpp:959
    +                                             2778 IPC::Connection::dispatchMessage(std::__1::unique_ptr<IPC::Decoder, std::__1::default_delete<IPC::Decoder> >)  (in WebKit) + 712  [0x10a4bb0b8]  Connection.cpp:928
    +                                               2778 IPC::Connection::dispatchMessage(IPC::Decoder&)  (in WebKit) + 51  [0x10a4c5a33]  Connection.cpp:901
    +                                                 2778 WebKit::WebToStorageProcessConnection::didReceiveMessage(IPC::Connection&, IPC::Decoder&)  (in WebKit) + 621  [0x10b1bc06d]  WebToStorageProcessConnection.cpp:82
    +                                                   2778 WebKit::WebSWContextManagerConnection::didReceiveMessage(IPC::Connection&, IPC::Decoder&)  (in WebKit) + 770  [0x10b18c192]  WebSWContextManagerConnectionMessageReceiver.cpp:103
    +                                                     2778 void IPC::handleMessage<Messages::WebSWContextManagerConnection::TerminateWorker, WebKit::WebSWContextManagerConnection, void (WebKit::WebSWContextManagerConnection::*)(WTF::ObjectIdentifier<WebCore::ServiceWorkerIdentifierType>)>(IPC::Decoder&, WebKit::WebSWContextManagerConnection*, void (WebKit::WebSWContextManagerConnection::*)(WTF::ObjectIdentifier<WebCore::ServiceWorkerIdentifierType>))  (in WebKit) + 261  [0x10b18cf65]  HandleMessage.h:126
    +                                                       2778 void IPC::callMemberFunction<WebKit::WebSWContextManagerConnection, void (WebKit::WebSWContextManagerConnection::*)(WTF::ObjectIdentifier<WebCore::ServiceWorkerIdentifierType>), std::__1::tuple<WTF::ObjectIdentifier<WebCore::ServiceWorkerIdentifierType> >, std::__1::integer_sequence<unsigned long, 0ul> >(std::__1::tuple<WTF::ObjectIdentifier<WebCore::ServiceWorkerIdentifierType> >&&, WebKit::WebSWContextManagerConnection*, void (WebKit::WebSWContextManagerConnection::*)(WTF::ObjectIdentifier<WebCore::ServiceWorkerIdentifierType>))  (in WebKit) + 96  [0x10b190c00]  HandleMessage.h:46
    +                                                         2778 void IPC::callMemberFunctionImpl<WebKit::WebSWContextManagerConnection, void (WebKit::WebSWContextManagerConnection::*)(WTF::ObjectIdentifier<WebCore::ServiceWorkerIdentifierType>), std::__1::tuple<WTF::ObjectIdentifier<WebCore::ServiceWorkerIdentifierType> >, 0ul>(WebKit::WebSWContextManagerConnection*, void (WebKit::WebSWContextManagerConnection::*)(WTF::ObjectIdentifier<WebCore::ServiceWorkerIdentifierType>), std::__1::tuple<WTF::ObjectIdentifier<WebCore::ServiceWorkerIdentifierType> >&&, std::__1::integer_sequence<unsigned long, 0ul>)  (in WebKit) + 165  [0x10b190dc5]  HandleMessage.h:40
    +                                                           2778 WebKit::WebSWContextManagerConnection::terminateWorker(WTF::ObjectIdentifier<WebCore::ServiceWorkerIdentifierType>)  (in WebKit) + 63  [0x10b177f7f]  WebSWContextManagerConnection.cpp:198
    +                                                             2778 WebCore::SWContextManager::terminateWorker(WTF::ObjectIdentifier<WebCore::ServiceWorkerIdentifierType>, WTF::Function<void ()>&&)  (in WebCore) + 215  [0x79b356497]  SWContextManager.cpp:113
    +                                                               2778 WebCore::WorkerThread::stop(WTF::Function<void ()>&&)  (in WebCore) + 57  [0x79b2f1f29]  WorkerThread.cpp:268
    +                                                                 2778 WTF::Locker<WTF::Lock>::Locker(WTF::Lock&)  (in WebCore) + 29  [0x79802fd8d]  Locker.h:54
    +                                                                   2778 WTF::Locker<WTF::Lock>::Locker(WTF::Lock&)  (in WebCore) + 48  [0x7980326e0]  Locker.h:54
    +                                                                     2778 WTF::Locker<WTF::Lock>::lock()  (in WebCore) + 42  [0x79803272a]  Locker.h:112
    +                                                                       2778 WTF::Lock::lock()  (in WebCore) + 53  [0x79801eb55]  Lock.h:60
    +                                                                         2778 WTF::Lock::lockSlow()  (in JavaScriptCore) + 21  [0x7a8634c65]  Lock.cpp:40
    +                                                                           2778 WTF::LockAlgorithm<unsigned char, (unsigned char)1, (unsigned char)2, WTF::EmptyLockHooks<unsigned char> >::lockSlow(WTF::Atomic<unsigned char>&)  (in JavaScriptCore) + 390  [0x7a8634df6]  LockAlgorithmInlines.h:84
    +                                                                             2778 WTF::ParkingLot::ParkResult WTF::ParkingLot::compareAndPark<unsigned char, unsigned char>(WTF::Atomic<unsigned char> const*, unsigned char)  (in JavaScriptCore) + 85  [0x7a8197225]  ParkingLot.h:93
    +                                                                               2778 WTF::ParkingLot::ParkResult WTF::ParkingLot::parkConditionally<WTF::ParkingLot::ParkResult WTF::ParkingLot::compareAndPark<unsigned char, unsigned char>(WTF::Atomic<unsigned char> const*, unsigned char)::'lambda'(), WTF::ParkingLot::ParkResult WTF::ParkingLot::compareAndPark<unsigned char, unsigned char>(WTF::Atomic<unsigned char> const*, unsigned char)::'lambda0'()>(void const*, unsigned char const&, unsigned char const&, WTF::TimeWithDynamicClockType const&)  (in JavaScriptCore) + 96  [0x7a81972e0]  ParkingLot.h:81
    +                                                                                 2778 WTF::ParkingLot::parkConditionallyImpl(void const*, WTF::ScopedLambda<bool ()> const&, WTF::ScopedLambda<void ()> const&, WTF::TimeWithDynamicClockType const&)  (in JavaScriptCore) + 411  [0x7a864dadb]  ParkingLot.cpp:597
    +                                                                                   2778 WTF::ThreadCondition::timedWait(WTF::Mutex&, double)  (in JavaScriptCore) + 104  [0x7a868ac98]  ThreadingPthreads.cpp:558
    +                                                                                     2778 WTF::ThreadCondition::wait(WTF::Mutex&)  (in JavaScriptCore) + 48  [0x7a868abe0]  ThreadingPthreads.cpp:548
    +                                                                                       2778 _pthread_cond_wait  (in libsystem_pthread.dylib) + 732  [0x7fff650ad662]
    +                                                                                         2778 __psynch_cvwait  (in libsystem_kernel.dylib) + 10  [0x7fff64f70cee]


Worker Thread:
    2778 Thread_12838245: WebCore: Worker
      2778 thread_start  (in libsystem_pthread.dylib) + 13  [0x7fff650abc5d]
        2778 _pthread_start  (in libsystem_pthread.dylib) + 377  [0x7fff650ac56d]
          2778 _pthread_body  (in libsystem_pthread.dylib) + 340  [0x7fff650ac6c1]
            2778 WTF::wtfThreadEntryPoint(void*)  (in JavaScriptCore) + 21  [0x7a8689e85]  ThreadingPthreads.cpp:223
              2778 WTF::Thread::entryPoint(WTF::Thread::NewThreadContext*)  (in JavaScriptCore) + 351  [0x7a868472f]  Threading.cpp:129
                2778 WTF::Function<void ()>::operator()() const  (in JavaScriptCore) + 139  [0x7a86148fb]  Function.h:56
                  2778 WTF::Function<void ()>::CallableWrapper<WebCore::WorkerThread::start(WTF::Function<void (WTF::String const&)>&&)::$_12>::call()  (in WebCore) + 25  [0x79b303309]  Function.h:101
                    2778 WebCore::WorkerThread::start(WTF::Function<void (WTF::String const&)>&&)::$_12::operator()() const  (in WebCore) + 24  [0x79b303348]  WorkerThread.cpp:144
                      2778 WebCore::WorkerThread::workerThread()  (in WebCore) + 877  [0x79b2f6e8d]  WorkerThread.cpp:168
                        2778 WebCore::ServiceWorkerThread::createWorkerGlobalScope(WebCore::URL const&, WTF::String const&, WTF::String const&, bool, WebCore::ContentSecurityPolicyResponseHeaders const&, bool, WTF::Ref<WebCore::SecurityOrigin, WTF::DumbPtrTraits<WebCore::SecurityOrigin> >&&, WTF::MonotonicTime, PAL::SessionID)  (in WebCore) + 433  [0x79b357f71]  ServiceWorkerThread.cpp:85
                          2778 WebCore::ServiceWorkerGlobalScope::create(WebCore::ServiceWorkerContextData const&, WebCore::URL const&, WTF::String const&, WTF::String const&, bool, WebCore::ServiceWorkerThread&, WebCore::ContentSecurityPolicyResponseHeaders const&, bool, WTF::Ref<WebCore::SecurityOrigin, WTF::DumbPtrTraits<WebCore::SecurityOrigin> >&&, WTF::MonotonicTime, WebCore::IDBClient::IDBConnectionProxy*, WebCore::SocketProvider*, PAL::SessionID)  (in WebCore) + 469  [0x79b32ff85]  ServiceWorkerGlobalScope.cpp:43
                            2778 WebCore::ServiceWorkerGlobalScope::ServiceWorkerGlobalScope(WebCore::ServiceWorkerContextData const&, WebCore::URL const&, WTF::String const&, WTF::String const&, bool, WebCore::ServiceWorkerThread&, bool, WTF::Ref<WebCore::SecurityOrigin, WTF::DumbPtrTraits<WebCore::SecurityOrigin> >&&, WTF::MonotonicTime, WebCore::IDBClient::IDBConnectionProxy*, WebCore::SocketProvider*, PAL::SessionID)  (in WebCore) + 217  [0x79b330139]  ServiceWorkerGlobalScope.cpp:53
                              2778 WebCore::ServiceWorkerGlobalScope::ServiceWorkerGlobalScope(WebCore::ServiceWorkerContextData const&, WebCore::URL const&, WTF::String const&, WTF::String const&, bool, WebCore::ServiceWorkerThread&, bool, WTF::Ref<WebCore::SecurityOrigin, WTF::DumbPtrTraits<WebCore::SecurityOrigin> >&&, WTF::MonotonicTime, WebCore::IDBClient::IDBConnectionProxy*, WebCore::SocketProvider*, PAL::SessionID)  (in WebCore) + 587  [0x79b3303fb]  ServiceWorkerGlobalScope.cpp:51
                                2778 WebCore::ServiceWorkerRegistration::getOrCreate(WebCore::ScriptExecutionContext&, WTF::Ref<WebCore::ServiceWorkerContainer, WTF::DumbPtrTraits<WebCore::ServiceWorkerContainer> >&&, WebCore::ServiceWorkerRegistrationData&&)  (in WebCore) + 229  [0x79b32c6f5]  ServiceWorkerRegistration.cpp:49
                                  2778 WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration(WebCore::ScriptExecutionContext&, WTF::Ref<WebCore::ServiceWorkerContainer, WTF::DumbPtrTraits<WebCore::ServiceWorkerContainer> >&&, WebCore::ServiceWorkerRegistrationData&&)  (in WebCore) + 45  [0x79b3327bd]  ServiceWorkerRegistration.cpp:56
                                    2778 WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration(WebCore::ScriptExecutionContext&, WTF::Ref<WebCore::ServiceWorkerContainer, WTF::DumbPtrTraits<WebCore::ServiceWorkerContainer> >&&, WebCore::ServiceWorkerRegistrationData&&)  (in WebCore) + 773  [0x79b332ad5]  ServiceWorkerRegistration.cpp:67
                                      2778 WebCore::ServiceWorkerContainer::addRegistration(WebCore::ServiceWorkerRegistration&)  (in WebCore) + 117  [0x79b32f3b5]  ServiceWorkerContainer.cpp:548
                                        2778 WebCore::ServiceWorkerContainer::ensureSWClientConnection()  (in WebCore) + 174  [0x79b32a0ce]  ServiceWorkerContainer.cpp:535
                                          2778 WTF::callOnMainThreadAndWait(WTF::Function<void ()>&&)  (in JavaScriptCore) + 271  [0x7a86386ff]  MainThread.cpp:236
                                            2778 void WTF::Condition::wait<std::__1::unique_lock<WTF::Lock>, WTF::callOnMainThreadAndWait(WTF::Function<void ()>&&)::$_4>(std::__1::unique_lock<WTF::Lock>&, WTF::callOnMainThreadAndWait(WTF::Function<void ()>&&)::$_4 const&)  (in JavaScriptCore) + 65  [0x7a86387e1]  Condition.h:130
                                              2778 void WTF::Condition::wait<std::__1::unique_lock<WTF::Lock> >(std::__1::unique_lock<WTF::Lock>&)  (in JavaScriptCore) + 73  [0x7a863a4a9]  Condition.h:123
                                                2778 bool WTF::Condition::waitUntil<std::__1::unique_lock<WTF::Lock> >(std::__1::unique_lock<WTF::Lock>&, WTF::TimeWithDynamicClockType const&)  (in JavaScriptCore) + 140  [0x7a863a54c]  Condition.h:77
                                                  2778 WTF::ParkingLot::ParkResult WTF::ParkingLot::parkConditionally<bool WTF::Condition::waitUntil<std::__1::unique_lock<WTF::Lock> >(std::__1::unique_lock<WTF::Lock>&, WTF::TimeWithDynamicClockType const&)::'lambda'(), bool WTF::Condition::waitUntil<std::__1::unique_lock<WTF::Lock> >(std::__1::unique_lock<WTF::Lock>&, WTF::TimeWithDynamicClockType const&)::'lambda0'()>(void const*, std::__1::unique_lock<WTF::Lock> const&, bool WTF::Condition::waitUntil<std::__1::unique_lock<WTF::Lock> >(std::__1::unique_lock<WTF::Lock>&, WTF::TimeWithDynamicClockType const&)::'lambda0'() const&, WTF::TimeWithDynamicClockType const&)  (in JavaScriptCore) + 96  [0x7a863a630]  ParkingLot.h:81
                                                    2778 WTF::ParkingLot::parkConditionallyImpl(void const*, WTF::ScopedLambda<bool ()> const&, WTF::ScopedLambda<void ()> const&, WTF::TimeWithDynamicClockType const&)  (in JavaScriptCore) + 411  [0x7a864dadb]  ParkingLot.cpp:597
                                                      2778 WTF::ThreadCondition::timedWait(WTF::Mutex&, double)  (in JavaScriptCore) + 104  [0x7a868ac98]  ThreadingPthreads.cpp:558
                                                        2778 WTF::ThreadCondition::wait(WTF::Mutex&)  (in JavaScriptCore) + 48  [0x7a868abe0]  ThreadingPthreads.cpp:548
                                                          2778 _pthread_cond_wait  (in libsystem_pthread.dylib) + 732  [0x7fff650ad662]
                                                            2778 __psynch_cvwait  (in libsystem_kernel.dylib) + 10  [0x7fff64f70cee]


Basically, it happens when terminating a worker that is still starting because of the m_threadCreationAndWorkerGlobalScopeMutex Mutex in WorkerThread and the callOnMainThreadAndWait() call in ServiceWorkerContainer::ensureSWClientConnection().

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20180117/e6d32e82/attachment-0001.html>


More information about the webkit-unassigned mailing list