<?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>173738</bug_id>
          
          <creation_ts>2017-06-22 15:12:07 -0700</creation_ts>
          <short_desc>isMainThread() assertions in CallbackMap are incorrectly failing on some iOS apps</short_desc>
          <delta_ts>2017-06-22 18:57:48 -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>WebKit2</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=173680</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=173745</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Chris Dumez">cdumez</reporter>
          <assigned_to name="Chris Dumez">cdumez</assigned_to>
          <cc>beidson</cc>
    
    <cc>commit-queue</cc>
    
    <cc>dbates</cc>
    
    <cc>rniwa</cc>
    
    <cc>sam</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>wenson_hsieh</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1322077</commentid>
    <comment_count>0</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2017-06-22 15:12:07 -0700</bug_when>
    <thetext>isMainThread() assertions in CallbackMap are incorrectly failing on some iOS apps.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1322078</commentid>
    <comment_count>1</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2017-06-22 15:12:24 -0700</bug_when>
    <thetext>&lt;rdar://problem/32923933&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1322081</commentid>
    <comment_count>2</comment_count>
      <attachid>313664</attachid>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2017-06-22 15:14:24 -0700</bug_when>
    <thetext>Created attachment 313664
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1322089</commentid>
    <comment_count>3</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2017-06-22 15:24:10 -0700</bug_when>
    <thetext>Committed r218724: &lt;http://trac.webkit.org/changeset/218724&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1322090</commentid>
    <comment_count>4</comment_count>
    <who name="Daniel Bates">dbates</who>
    <bug_when>2017-06-22 15:33:24 -0700</bug_when>
    <thetext>We use WTF::isMainThread() all over the place in the code base, including throughout WebKit2. Do you plan to these to RunLoop::isMain()? Can we get rid of WTF::isMainThread()?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1322091</commentid>
    <comment_count>5</comment_count>
    <who name="Daniel Bates">dbates</who>
    <bug_when>2017-06-22 15:33:55 -0700</bug_when>
    <thetext>(In reply to Daniel Bates from comment #4)
&gt; Do you plan to these to RunLoop::isMain()?

*Do you plan to update these to use RunLoop::isMain()?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1322095</commentid>
    <comment_count>6</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2017-06-22 15:41:03 -0700</bug_when>
    <thetext>(In reply to Daniel Bates from comment #5)
&gt; (In reply to Daniel Bates from comment #4)
&gt; &gt; Do you plan to these to RunLoop::isMain()?
&gt; 
&gt; *Do you plan to update these to use RunLoop::isMain()?

Given the apps that were impacted and the implementation of isMainThread(), we suspect the issue has to do with mixing WebKit1 and WebKit2 in the UIProcess.

So yes, I think we should update assertions running in the UIProcess to use RunLoop::isMain() rather than isMainThread().</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1322107</commentid>
    <comment_count>7</comment_count>
    <who name="Daniel Bates">dbates</who>
    <bug_when>2017-06-22 16:09:14 -0700</bug_when>
    <thetext>(In reply to Chris Dumez from comment #6)
&gt; (In reply to Daniel Bates from comment #5)
&gt; &gt; (In reply to Daniel Bates from comment #4)
&gt; &gt; &gt; Do you plan to these to RunLoop::isMain()?
&gt; &gt; 
&gt; &gt; *Do you plan to update these to use RunLoop::isMain()?
&gt; 
&gt; Given the apps that were impacted and the implementation of isMainThread(),
&gt; we suspect the issue has to do with mixing WebKit1 and WebKit2 in the
&gt; UIProcess.
&gt; 
&gt; So yes, I think we should update assertions running in the UIProcess to use
&gt; RunLoop::isMain() rather than isMainThread().

&quot;think&quot;? Is RunLoop:isMain() the solution or not? If it is then please substitute RunLoop:isMain() in all UIProcess code that uses WTF::isMainThread(). If we cannot do such substitution mechanically then please explain how to interpret the second sentence of your ChangeLog message.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1322108</commentid>
    <comment_count>8</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2017-06-22 16:12:01 -0700</bug_when>
    <thetext>(In reply to Daniel Bates from comment #7)
&gt; (In reply to Chris Dumez from comment #6)
&gt; &gt; (In reply to Daniel Bates from comment #5)
&gt; &gt; &gt; (In reply to Daniel Bates from comment #4)
&gt; &gt; &gt; &gt; Do you plan to these to RunLoop::isMain()?
&gt; &gt; &gt; 
&gt; &gt; &gt; *Do you plan to update these to use RunLoop::isMain()?
&gt; &gt; 
&gt; &gt; Given the apps that were impacted and the implementation of isMainThread(),
&gt; &gt; we suspect the issue has to do with mixing WebKit1 and WebKit2 in the
&gt; &gt; UIProcess.
&gt; &gt; 
&gt; &gt; So yes, I think we should update assertions running in the UIProcess to use
&gt; &gt; RunLoop::isMain() rather than isMainThread().
&gt; 
&gt; &quot;think&quot;? Is RunLoop:isMain() the solution or not? If it is then please
&gt; substitute RunLoop:isMain() in all UIProcess code that uses
&gt; WTF::isMainThread(). If we cannot do such substitution mechanically then
&gt; please explain how to interpret the second sentence of your ChangeLog
&gt; message.

What I said, upon local testing RunLoop::isMain() was returning the correct result but WTF::isMainThread() wasn&apos;t.

My only speculation is about why WTF::isMainThread() does not return the correct result. That part I do not know for sure. My priority was to unbreak those apps.

A mechanical change in WebKit2 sounds fine.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1322109</commentid>
    <comment_count>9</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2017-06-22 16:14:53 -0700</bug_when>
    <thetext>(In reply to Daniel Bates from comment #7)
&gt; (In reply to Chris Dumez from comment #6)
&gt; &gt; (In reply to Daniel Bates from comment #5)
&gt; &gt; &gt; (In reply to Daniel Bates from comment #4)
&gt; &gt; &gt; &gt; Do you plan to these to RunLoop::isMain()?
&gt; &gt; &gt; 
&gt; &gt; &gt; *Do you plan to update these to use RunLoop::isMain()?
&gt; &gt; 
&gt; &gt; Given the apps that were impacted and the implementation of isMainThread(),
&gt; &gt; we suspect the issue has to do with mixing WebKit1 and WebKit2 in the
&gt; &gt; UIProcess.
&gt; &gt; 
&gt; &gt; So yes, I think we should update assertions running in the UIProcess to use
&gt; &gt; RunLoop::isMain() rather than isMainThread().
&gt; 
&gt; &quot;think&quot;? Is RunLoop:isMain() the solution or not? If it is then please
&gt; substitute RunLoop:isMain() in all UIProcess code that uses
&gt; WTF::isMainThread(). If we cannot do such substitution mechanically then
&gt; please explain how to interpret the second sentence of your ChangeLog
&gt; message.

FYI, you make it really hard for foreigners like me to talk to you if you&apos;re going to pick on a given wording like that.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1322110</commentid>
    <comment_count>10</comment_count>
    <who name="Daniel Bates">dbates</who>
    <bug_when>2017-06-22 16:26:33 -0700</bug_when>
    <thetext>(In reply to Chris Dumez from comment #9)
&gt; (In reply to Daniel Bates from comment #7)
&gt; &gt; (In reply to Chris Dumez from comment #6)
&gt; &gt; &gt; (In reply to Daniel Bates from comment #5)
&gt; &gt; &gt; &gt; (In reply to Daniel Bates from comment #4)
&gt; &gt; &gt; &gt; &gt; Do you plan to these to RunLoop::isMain()?
&gt; &gt; &gt; &gt; 
&gt; &gt; &gt; &gt; *Do you plan to update these to use RunLoop::isMain()?
&gt; &gt; &gt; 
&gt; &gt; &gt; Given the apps that were impacted and the implementation of isMainThread(),
&gt; &gt; &gt; we suspect the issue has to do with mixing WebKit1 and WebKit2 in the
&gt; &gt; &gt; UIProcess.
&gt; &gt; &gt; 
&gt; &gt; &gt; So yes, I think we should update assertions running in the UIProcess to use
&gt; &gt; &gt; RunLoop::isMain() rather than isMainThread().
&gt; &gt; 
&gt; &gt; &quot;think&quot;? Is RunLoop:isMain() the solution or not? If it is then please
&gt; &gt; substitute RunLoop:isMain() in all UIProcess code that uses
&gt; &gt; WTF::isMainThread(). If we cannot do such substitution mechanically then
&gt; &gt; please explain how to interpret the second sentence of your ChangeLog
&gt; &gt; message.
&gt; 
&gt; FYI, you make it really hard for foreigners like me to talk to you if you&apos;re
&gt; going to pick on a given wording like that.

How do you suggest a person interpret your wording? I mean, the only available information that the general public has is what is written in the comments in this bug and in the ChangeLog/commit message. Maybe it would be better to discuss this over a different medium?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1322125</commentid>
    <comment_count>11</comment_count>
    <who name="Daniel Bates">dbates</who>
    <bug_when>2017-06-22 16:51:42 -0700</bug_when>
    <thetext>(In reply to Chris Dumez from comment #8)
&gt; (In reply to Daniel Bates from comment #7)
&gt; &gt; (In reply to Chris Dumez from comment #6)
&gt; &gt; &gt; (In reply to Daniel Bates from comment #5)
&gt; &gt; &gt; &gt; (In reply to Daniel Bates from comment #4)
&gt; &gt; &gt; &gt; &gt; Do you plan to these to RunLoop::isMain()?
&gt; &gt; &gt; &gt; 
&gt; &gt; &gt; &gt; *Do you plan to update these to use RunLoop::isMain()?
&gt; &gt; &gt; 
&gt; &gt; &gt; Given the apps that were impacted and the implementation of isMainThread(),
&gt; &gt; &gt; we suspect the issue has to do with mixing WebKit1 and WebKit2 in the
&gt; &gt; &gt; UIProcess.
&gt; &gt; &gt; 
&gt; &gt; &gt; So yes, I think we should update assertions running in the UIProcess to use
&gt; &gt; &gt; RunLoop::isMain() rather than isMainThread().
&gt; &gt; 
&gt; &gt; &quot;think&quot;? Is RunLoop:isMain() the solution or not? If it is then please
&gt; &gt; substitute RunLoop:isMain() in all UIProcess code that uses
&gt; &gt; WTF::isMainThread(). If we cannot do such substitution mechanically then
&gt; &gt; please explain how to interpret the second sentence of your ChangeLog
&gt; &gt; message.
&gt; 
&gt; What I said, upon local testing RunLoop::isMain() was returning the correct
&gt; result but WTF::isMainThread() wasn&apos;t.
&gt; 
&gt; My only speculation is about why WTF::isMainThread() does not return the
&gt; correct result. That part I do not know for sure. My priority was to unbreak
&gt; those apps.
&gt; 
&gt; A mechanical change in WebKit2 sounds fine.

Filed bug #173745 to investigate WTF::isMainThread() and/or substitute RunLoop:isMain() for uses of WTF::isMainThread().</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1322162</commentid>
    <comment_count>12</comment_count>
    <who name="Daniel Bates">dbates</who>
    <bug_when>2017-06-22 18:57:48 -0700</bug_when>
    <thetext>(In reply to Chris Dumez from comment #9)
&gt; FYI, you make it really hard for foreigners like me to talk to you if you&apos;re
&gt; going to pick on a given wording like that.

This has nothing to do with you being a foreigner. I just wanted to clarify whether using RunLoop:isMain() is the correct solution to fix this bug (as opposed to fixing WTF::isMainThread() or some other solution) as well as ascertain when can we expect to replace uses of WTF::isMainThread() with RunLoop:isMain() throughout our codebase assuming using RunLoop:isMain() is the correct solution. We now have bug #173745 tracking this clarification/discussion.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>313664</attachid>
            <date>2017-06-22 15:14:24 -0700</date>
            <delta_ts>2017-06-22 15:27:55 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-173738-20170622151424.patch</filename>
            <type>text/plain</type>
            <size>2269</size>
            <attacher name="Chris Dumez">cdumez</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjE4NzEzCmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViS2l0Mi9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViS2l0Mi9DaGFuZ2VMb2cKaW5kZXggMGM4ZDdkMThhNzJkZThm
NTg1YzY4ZGQyNmRkMGFhM2NkMmFlODYxMy4uZjZmNDMzZjk2ZmVlOWRjMDc3OWYyMjVmYTk2YzRh
ZDgzYjJiMjhlZSAxMDA2NDQKLS0tIGEvU291cmNlL1dlYktpdDIvQ2hhbmdlTG9nCisrKyBiL1Nv
dXJjZS9XZWJLaXQyL0NoYW5nZUxvZwpAQCAtMSwzICsxLDIxIEBACisyMDE3LTA2LTIyICBDaHJp
cyBEdW1leiAgPGNkdW1lekBhcHBsZS5jb20+CisKKyAgICAgICAgaXNNYWluVGhyZWFkKCkgYXNz
ZXJ0aW9ucyBpbiBDYWxsYmFja01hcCBhcmUgaW5jb3JyZWN0bHkgZmFpbGluZyBvbiBzb21lIGlP
UyBhcHBzCisgICAgICAgIGh0dHBzOi8vYnVncy53ZWJraXQub3JnL3Nob3dfYnVnLmNnaT9pZD0x
NzM3MzgKKyAgICAgICAgPHJkYXI6Ly9wcm9ibGVtLzMyOTIzOTMzPgorCisgICAgICAgIFJldmll
d2VkIGJ5IE5PQk9EWSAoT09QUyEpLgorCisgICAgICAgIFRoZSBhc3NlcnRpb25zIGhpdCBvbiBj
ZXJ0YWluIGlPUyBhcHBzIGV2ZW4gdGhvdWdoIHRoZSBjcmFzaCB0cmFjZXMgY2xlYXJseQorICAg
ICAgICBzaG93IHRoZW0gb24gdGhlIG1haW4gdGhyZWFkLiBXZSBoYXZlIHZlcmlmaWVkIGxvY2Fs
bHkgdGhhdCBSdW5Mb29wOjppc01haW4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CYXNlPiYmIGNhbGxiYWNrKQogICAgIHsKLSAgICAgICAgUkVMRUFTRV9B
U1NFUlQoaXNNYWluVGhyZWFkKCkpOworICAgICAgICBSRUxFQVNFX0FTU0VSVChSdW5Mb29wOjpp
c01haW4oKSk7CiAgICAgICAgIHVpbnQ2NF90IGNhbGxiYWNrSUQgPSBjYWxsYmFjay0+Y2FsbGJh
Y2tJRCgpOwogICAgICAgICBSRUxFQVNFX0FTU0VSVChjYWxsYmFja0lEKTsKICAgICAgICAgUkVM
RUFTRV9BU1NFUlQoIW1fbWFwLmNvbnRhaW5zKGNhbGxiYWNrSUQpKTsKQEAgLTIxMSw3ICsyMTEs
NyBAQCBwdWJsaWM6CiAgICAgUmVmUHRyPFQ+IHRha2UodWludDY0X3QgY2FsbGJhY2tJRCkKICAg
ICB7CiAgICAgICAgIFJFTEVBU0VfQVNTRVJUKGNhbGxiYWNrSUQpOwotICAgICAgICBSRUxFQVNF
X0FTU0VSVChpc01haW5UaHJlYWQoKSk7CisgICAgICAgIFJFTEVBU0VfQVNTRVJUKFJ1bkxvb3A6
OmlzTWFpbigpKTsKICAgICAgICAgYXV0byBiYXNlID0gbV9tYXAudGFrZShjYWxsYmFja0lEKTsK
ICAgICAgICAgaWYgKCFiYXNlKQogICAgICAgICAgICAgcmV0dXJuIG51bGxwdHI7CkBAIC0yMjEs
NyArMjIxLDcgQEAgcHVibGljOgogCiAgICAgdm9pZCBpbnZhbGlkYXRlKENhbGxiYWNrQmFzZTo6
RXJyb3IgZXJyb3IpCiAgICAgewotICAgICAgICBSRUxFQVNFX0FTU0VSVChpc01haW5UaHJlYWQo
KSk7CisgICAgICAgIFJFTEVBU0VfQVNTRVJUKFJ1bkxvb3A6OmlzTWFpbigpKTsKICAgICAgICAg
aW52YWxpZGF0ZUNhbGxiYWNrTWFwKG1fbWFwLCBlcnJvcik7CiAgICAgfQogCg==
</data>

          </attachment>
      

    </bug>

</bugzilla>