<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>175852</bug_id>
          
          <creation_ts>2017-08-22 14:22:02 -0700</creation_ts>
          <short_desc>Race condition in StartWebThread causing crash</short_desc>
          <delta_ts>2017-08-23 10:42:10 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit API</component>
          <version>Other</version>
          <rep_platform>iPhone / iPad</rep_platform>
          <op_sys>iOS 10.3</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ben Nham">nham</reporter>
          <assigned_to name="Yusuke Suzuki">ysuzuki</assigned_to>
          <cc>fpizlo</cc>
    
    <cc>ggaren</cc>
    
    <cc>kling</cc>
    
    <cc>mark.lam</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>ysuzuki</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1341266</commentid>
    <comment_count>0</comment_count>
    <who name="Ben Nham">nham</who>
    <bug_when>2017-08-22 14:22:02 -0700</bug_when>
    <thetext>We have been seeing an increasing number of crashes in the Facebook app due to a race condition in StartWebThread. The crash involves a race between the main thread and the web thread.

The main thread crashes in this RELEASE_ASSERT in ThreadIdentifierData:

  https://opensource.apple.com/source/WTF/WTF-7603.1.30.1.33/wtf/ThreadIdentifierDataPthreads.cpp.auto.html (line 78)

The main thread&apos;s stack is:

  Thread #0 Crashed:
  0 JavaScriptCore 0x1882aabf8 WTF::ThreadIdentifierData::initialize(unsigned int) + 72
  1 JavaScriptCore 0x1882a9188 WTF::currentThread() + 48
  2 JavaScriptCore 0x1882a9188 WTF::currentThread() + 48
  3 JavaScriptCore 0x1882aac04 WTF::initializeApplicationUIThreadIdentifier() + 8
  4 WebCore 0x188f76bec StartWebThread() + 504
  5 libsystem_pthread.dylib 0x18348f418 __pthread_once_handler + 76
  6 libsystem_platform.dylib 0x183484a44 _os_once + 48
  7 libsystem_pthread.dylib 0x18348c2fc pthread_once + 64
  8 WebKitLegacy 0x18a15ba54 +[WebView(WebPrivate) enableWebThread] + 268
  9 WebKitLegacy 0x18a15b68c WebKitInitialize + 68
  10 UIKit 0x18a781dd0 ___UIApplicationLoadWebKit_block_invoke + 212
  11 libdispatch.dylib 0x18328299c _dispatch_client_callout + 12
  12 libdispatch.dylib 0x1832836c8 dispatch_once_f + 52
  13 libdispatch.dylib 0x18328299c _dispatch_client_callout + 12
  14 libdispatch.dylib 0x1832937a4 _dispatch_barrier_sync_f_slow_invoke + 300
  15 libdispatch.dylib 0x18328299c _dispatch_client_callout + 12
  16 libdispatch.dylib 0x1832875e4 _dispatch_main_queue_callback_4CF + 992
  17 CoreFoundation 0x1843790c4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
  18 CoreFoundation 0x184376ce0 __CFRunLoopRun + 1568
  19 CoreFoundation 0x1842a6da0 CFRunLoopRunSpecific + 420
  20 GraphicsServices 0x185d11070 GSEventRunModal + 96
  21 UIKit 0x18a561c98 UIApplicationMain + 204
  22 Facebook 0x1000b5738 FBGenericMain (FBGenericMain.m:224)
  23 Facebook 0x1000b5240 main (main.m:150)
  24 libdyld.dylib 0x1832b5598 start + 0

This RELEASE_ASSERT fires if the pthread TSD key hasn&apos;t yet been created. The TSD key is created by WTF::initializeThreading, which is called by JSC::initializeThreading. So basically, the crash occurs because the MT called WTF::ThreadIdentifierData::initialize before another thread finished calling WTF::initializeThreading.

The thread that&apos;s responsible for calling WTF::initializeThreading is the WebThread (which is forked off by StartWebThread). The WebThread has this call stack in the crash:

  Thread #63:
  0 libsystem_kernel.dylib 0x1833c4f60 __psynch_rw_wrlock + 8
  1 libsystem_pthread.dylib 0x18348b5c8 _pthread_rwlock_lock + 464
  2 libobjc.A.dylib 0x182e35764 rwlock_tt&lt;false&gt;::write() + 100
  3 libobjc.A.dylib 0x182e2ebc4 _class_getNonMetaClass + 36
  4 libobjc.A.dylib 0x182e354ac lookUpImpOrForward + 220
  5 libobjc.A.dylib 0x182e40474 _objc_msgSend_uncached + 52
  6 libobjc.A.dylib 0x182e2d414 CALLING_SOME_+initialize_METHOD + 20
  7 libobjc.A.dylib 0x182e2d680 _class_initialize + 608
  8 libobjc.A.dylib 0x182e354b0 lookUpImpOrForward + 224
  9 libobjc.A.dylib 0x182e40474 _objc_msgSend_uncached + 52
  10 JavaScriptCore 0x1882a9958 WTF::initializeMainThreadPlatform() + 24
  11 libsystem_pthread.dylib 0x18348f418 __pthread_once_handler + 76
  12 libsystem_platform.dylib 0x183484a44 _os_once + 48
  13 libsystem_pthread.dylib 0x18348c2fc pthread_once + 64
  14 WebCore 0x188f78b94 RunWebThread(void*) + 32
  15 libsystem_pthread.dylib 0x18348d688 _pthread_body + 236
  16 libsystem_pthread.dylib 0x18348d598 _pthread_start + 280
  17 libsystem_pthread.dylib 0x18348acb0 thread_start + 0

If you look at the code, the WebThread is stuck two lines *before* the call to JSC::initializeThreading (which is what calls WTF::initializeThreading)--it&apos;s executing WTF::initializeMainThreadPlatform:

  https://opensource.apple.com/source/WebCore/WebCore-7603.1.30.1.33/platform/ios/wak/WebCoreThread.mm.auto.html (line 653)

In theory, there is some synchronization in the existing code that should prevent this from happening. In pseudo-code, the synchronization code looks like this:

  RunWebThread: (running on the web thread)
    JSC::initializeThreading()
    // other init...

    pthread_mutex_lock(&amp;lock)
    pthread_cond_signal(&amp;cond, &amp;lock)
    pthread_mutex_unlock(&amp;lock)

  StartWebThread: (running on the main thread)
    pthread_lock(&amp;lock)
    pthread_cond_wait(&amp;cond, &amp;lock)
    pthread_unlock(&amp;lock)

    WTF::initializeApplicationUIThreadIdentifier() // calls code which eventually asserts

However, this synchronization code is buggy because pthread_cond_wait is allowed to spuriously wake up, and pthread_cond_wait is only called once. It is very easy to demonstrate that spurious wakeups exist with pthread condition variables, e.g. here is a simple test program: https://gist.github.com/bnham/f2ca3430a7c4f6f714a918b62702125e

The fix is to add a boolean flag variable and to check whether that boolean variable is set while calling pthread_cond_wait in a loop, i.e. textbook usage of Mesa condition variables.

A possible mitigation for affected apps is to call some JSC API that eventually calls JSC::initializeThreading early on in app initialization.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1341270</commentid>
    <comment_count>1</comment_count>
    <who name="Ben Nham">nham</who>
    <bug_when>2017-08-22 14:30:30 -0700</bug_when>
    <thetext>Also filed a radar: &lt;rdar://34021573&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1341554</commentid>
    <comment_count>2</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2017-08-23 09:09:57 -0700</bug_when>
    <thetext>rdar://problem/34021570</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1341555</commentid>
    <comment_count>3</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2017-08-23 09:11:56 -0700</bug_when>
    <thetext>Good catch!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1341566</commentid>
    <comment_count>4</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2017-08-23 09:37:58 -0700</bug_when>
    <thetext>Recently[1], I changed this code to call WTF::initailizeThreading() in StartWebThread before spawning WebThread :)
This is OK because now WTF::initializeThreading does not have the limitation that requires WTF::initializeThreading() should be called in the main thread.

So in the trunk, I think this issue is fixed. What do you think of Mark?

[1]: http://trac.webkit.org/r219647</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1341569</commentid>
    <comment_count>5</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2017-08-23 09:42:27 -0700</bug_when>
    <thetext>(In reply to Ben Nham from comment #0)
&gt; We have been seeing an increasing number of crashes in the Facebook app due
&gt; to a race condition in StartWebThread. The crash involves a race between the
&gt; main thread and the web thread.
&gt; 
&gt; The main thread crashes in this RELEASE_ASSERT in ThreadIdentifierData:
&gt; 
&gt;  
&gt; https://opensource.apple.com/source/WTF/WTF-7603.1.30.1.33/wtf/
&gt; ThreadIdentifierDataPthreads.cpp.auto.html (line 78)
&gt; 
&gt; The main thread&apos;s stack is:
&gt; 
&gt;   Thread #0 Crashed:
&gt;   0 JavaScriptCore 0x1882aabf8
&gt; WTF::ThreadIdentifierData::initialize(unsigned int) + 72
&gt;   1 JavaScriptCore 0x1882a9188 WTF::currentThread() + 48
&gt;   2 JavaScriptCore 0x1882a9188 WTF::currentThread() + 48
&gt;   3 JavaScriptCore 0x1882aac04
&gt; WTF::initializeApplicationUIThreadIdentifier() + 8
&gt;   4 WebCore 0x188f76bec StartWebThread() + 504
&gt;   5 libsystem_pthread.dylib 0x18348f418 __pthread_once_handler + 76
&gt;   6 libsystem_platform.dylib 0x183484a44 _os_once + 48
&gt;   7 libsystem_pthread.dylib 0x18348c2fc pthread_once + 64
&gt;   8 WebKitLegacy 0x18a15ba54 +[WebView(WebPrivate) enableWebThread] + 268
&gt;   9 WebKitLegacy 0x18a15b68c WebKitInitialize + 68
&gt;   10 UIKit 0x18a781dd0 ___UIApplicationLoadWebKit_block_invoke + 212
&gt;   11 libdispatch.dylib 0x18328299c _dispatch_client_callout + 12
&gt;   12 libdispatch.dylib 0x1832836c8 dispatch_once_f + 52
&gt;   13 libdispatch.dylib 0x18328299c _dispatch_client_callout + 12
&gt;   14 libdispatch.dylib 0x1832937a4 _dispatch_barrier_sync_f_slow_invoke + 300
&gt;   15 libdispatch.dylib 0x18328299c _dispatch_client_callout + 12
&gt;   16 libdispatch.dylib 0x1832875e4 _dispatch_main_queue_callback_4CF + 992
&gt;   17 CoreFoundation 0x1843790c4
&gt; __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
&gt;   18 CoreFoundation 0x184376ce0 __CFRunLoopRun + 1568
&gt;   19 CoreFoundation 0x1842a6da0 CFRunLoopRunSpecific + 420
&gt;   20 GraphicsServices 0x185d11070 GSEventRunModal + 96
&gt;   21 UIKit 0x18a561c98 UIApplicationMain + 204
&gt;   22 Facebook 0x1000b5738 FBGenericMain (FBGenericMain.m:224)
&gt;   23 Facebook 0x1000b5240 main (main.m:150)
&gt;   24 libdyld.dylib 0x1832b5598 start + 0
&gt; 
&gt; This RELEASE_ASSERT fires if the pthread TSD key hasn&apos;t yet been created.
&gt; The TSD key is created by WTF::initializeThreading, which is called by
&gt; JSC::initializeThreading. So basically, the crash occurs because the MT
&gt; called WTF::ThreadIdentifierData::initialize before another thread finished
&gt; calling WTF::initializeThreading.
&gt; 
&gt; The thread that&apos;s responsible for calling WTF::initializeThreading is the
&gt; WebThread (which is forked off by StartWebThread). The WebThread has this
&gt; call stack in the crash:
&gt; 
&gt;   Thread #63:
&gt;   0 libsystem_kernel.dylib 0x1833c4f60 __psynch_rw_wrlock + 8
&gt;   1 libsystem_pthread.dylib 0x18348b5c8 _pthread_rwlock_lock + 464
&gt;   2 libobjc.A.dylib 0x182e35764 rwlock_tt&lt;false&gt;::write() + 100
&gt;   3 libobjc.A.dylib 0x182e2ebc4 _class_getNonMetaClass + 36
&gt;   4 libobjc.A.dylib 0x182e354ac lookUpImpOrForward + 220
&gt;   5 libobjc.A.dylib 0x182e40474 _objc_msgSend_uncached + 52
&gt;   6 libobjc.A.dylib 0x182e2d414 CALLING_SOME_+initialize_METHOD + 20
&gt;   7 libobjc.A.dylib 0x182e2d680 _class_initialize + 608
&gt;   8 libobjc.A.dylib 0x182e354b0 lookUpImpOrForward + 224
&gt;   9 libobjc.A.dylib 0x182e40474 _objc_msgSend_uncached + 52
&gt;   10 JavaScriptCore 0x1882a9958 WTF::initializeMainThreadPlatform() + 24
&gt;   11 libsystem_pthread.dylib 0x18348f418 __pthread_once_handler + 76
&gt;   12 libsystem_platform.dylib 0x183484a44 _os_once + 48
&gt;   13 libsystem_pthread.dylib 0x18348c2fc pthread_once + 64
&gt;   14 WebCore 0x188f78b94 RunWebThread(void*) + 32
&gt;   15 libsystem_pthread.dylib 0x18348d688 _pthread_body + 236
&gt;   16 libsystem_pthread.dylib 0x18348d598 _pthread_start + 280
&gt;   17 libsystem_pthread.dylib 0x18348acb0 thread_start + 0
&gt; 
&gt; If you look at the code, the WebThread is stuck two lines *before* the call
&gt; to JSC::initializeThreading (which is what calls
&gt; WTF::initializeThreading)--it&apos;s executing WTF::initializeMainThreadPlatform:
&gt; 
&gt;  
&gt; https://opensource.apple.com/source/WebCore/WebCore-7603.1.30.1.33/platform/
&gt; ios/wak/WebCoreThread.mm.auto.html (line 653)
&gt; 
&gt; In theory, there is some synchronization in the existing code that should
&gt; prevent this from happening. In pseudo-code, the synchronization code looks
&gt; like this:
&gt; 
&gt;   RunWebThread: (running on the web thread)
&gt;     JSC::initializeThreading()
&gt;     // other init...
&gt; 
&gt;     pthread_mutex_lock(&amp;lock)
&gt;     pthread_cond_signal(&amp;cond, &amp;lock)
&gt;     pthread_mutex_unlock(&amp;lock)
&gt; 
&gt;   StartWebThread: (running on the main thread)
&gt;     pthread_lock(&amp;lock)
&gt;     pthread_cond_wait(&amp;cond, &amp;lock)
&gt;     pthread_unlock(&amp;lock)
&gt; 
&gt;     WTF::initializeApplicationUIThreadIdentifier() // calls code which
&gt; eventually asserts
&gt; 
&gt; However, this synchronization code is buggy because pthread_cond_wait is
&gt; allowed to spuriously wake up, and pthread_cond_wait is only called once. It
&gt; is very easy to demonstrate that spurious wakeups exist with pthread
&gt; condition variables, e.g. here is a simple test program:
&gt; https://gist.github.com/bnham/f2ca3430a7c4f6f714a918b62702125e
&gt; 
&gt; The fix is to add a boolean flag variable and to check whether that boolean
&gt; variable is set while calling pthread_cond_wait in a loop, i.e. textbook
&gt; usage of Mesa condition variables.
&gt; 
&gt; A possible mitigation for affected apps is to call some JSC API that
&gt; eventually calls JSC::initializeThreading early on in app initialization.

BTW, I think your pointing is true that this pthread_cond_t use is broken due to the existence of the suspicious wakeup. We should fix this while the trunk do not show this problem. Our web threading&apos;s following code depends on that web thread is already initialized.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1341578</commentid>
    <comment_count>6</comment_count>
      <attachid>318880</attachid>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2017-08-23 09:57:40 -0700</bug_when>
    <thetext>Created attachment 318880
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1341601</commentid>
    <comment_count>7</comment_count>
      <attachid>318880</attachid>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2017-08-23 10:34:37 -0700</bug_when>
    <thetext>Comment on attachment 318880
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=318880&amp;action=review

r=me.

&gt; Source/WebCore/ChangeLog:9
&gt; +        by using pthread_cond_t. However, the main thread may be waken up due to the the existence of

/waken/woken/.

&gt; Source/WebCore/ChangeLog:10
&gt; +        the suspicious wakeup of the pthread_cond_t.

/suspicious/spurious/.

&gt; Source/WebCore/ChangeLog:14
&gt; +        does not have the suspicious wakup problem as described in Condition.h.

/suspicious/spurious/.
/wakup/wake up/.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1341605</commentid>
    <comment_count>8</comment_count>
      <attachid>318880</attachid>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2017-08-23 10:37:13 -0700</bug_when>
    <thetext>Comment on attachment 318880
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=318880&amp;action=review

Thank you!

&gt;&gt; Source/WebCore/ChangeLog:9
&gt;&gt; +        by using pthread_cond_t. However, the main thread may be waken up due to the the existence of
&gt; 
&gt; /waken/woken/.

Oops, thanks. Fixed.

&gt;&gt; Source/WebCore/ChangeLog:10
&gt;&gt; +        the suspicious wakeup of the pthread_cond_t.
&gt; 
&gt; /suspicious/spurious/.

Fixed.

&gt;&gt; Source/WebCore/ChangeLog:14
&gt;&gt; +        does not have the suspicious wakup problem as described in Condition.h.
&gt; 
&gt; /suspicious/spurious/.
&gt; /wakup/wake up/.

Fixed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1341612</commentid>
    <comment_count>9</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2017-08-23 10:42:10 -0700</bug_when>
    <thetext>Committed r221083: &lt;http://trac.webkit.org/changeset/221083&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>318880</attachid>
            <date>2017-08-23 09:57:40 -0700</date>
            <delta_ts>2017-08-23 10:34:37 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-175852-20170824015739.patch</filename>
            <type>text/plain</type>
            <size>4045</size>
            <attacher name="Yusuke Suzuki">ysuzuki</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjIxMDc1CmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXggZDNmYTRkNzM5N2Y5MWRi
MTk3OGJkNGQxYWE0Zjc1NDBjMTAxYmMzOC4uYTM0NjEyZDUzYzM3YWYwZTYxM2VhNjlhMWY0MjA4
MWZiN2JiNTA4NyAxMDA2NDQKLS0tIGEvU291cmNlL1dlYkNvcmUvQ2hhbmdlTG9nCisrKyBiL1Nv
dXJjZS9XZWJDb3JlL0NoYW5nZUxvZwpAQCAtMSwzICsxLDIyIEBACisyMDE3LTA4LTIzICBZdXN1
a2UgU3V6dWtpICA8dXRhdGFuZS50ZWFAZ21haWwuY29tPgorCisgICAgICAgIFJhY2UgY29uZGl0
aW9uIGluIFN0YXJ0V2Vi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JveSgmdGF0dHIpOworICAgICAgICBwdGhyZWFkX2NyZWF0ZSgmd2ViVGhyZWFkLCAmdGF0dHIs
IFJ1bldlYlRocmVhZCwgTlVMTCk7CisgICAgICAgIHB0aHJlYWRfYXR0cl9kZXN0cm95KCZ0YXR0
cik7CiAKLSAgICByZXN1bHQgPSBwdGhyZWFkX2NvbmRfd2FpdCgmc3RhcnR1cENvbmRpdGlvbiwg
JnN0YXJ0dXBMb2NrKTsKLSAgICBBU1NFUlRfV0lUSF9NRVNTQUdFKHJlc3VsdCA9PSAwLCAic3Rh
cnR1cCB3YWl0IGZhaWxlZCB3aXRoIGNvZGU6JWQiLCByZXN1bHQpOwotCi0gICAgcmVzdWx0ID0g
cHRocmVhZF9tdXRleF91bmxvY2soJnN0YXJ0dXBMb2NrKTsKLSAgICBBU1NFUlRfV0lUSF9NRVNT
QUdFKHJlc3VsdCA9PSAwLCAic3RhcnR1cCB1bmxvY2sgZmFpbGVkIHdpdGggY29kZTolZCIsIHJl
c3VsdCk7CisgICAgICAgIHN0YXJ0dXBDb25kaXRpb24ud2FpdChzdGFydHVwTG9jayk7CisgICAg
fQogCiAgICAgaW5pdGlhbGl6ZUFwcGxpY2F0aW9uVUlUaHJlYWRJZGVudGlmaWVyKCk7CiB9Cg==
</data>
<flag name="review"
          id="339245"
          type_id="1"
          status="+"
          setter="mark.lam"
    />
          </attachment>
      

    </bug>

</bugzilla>