<?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>107439</bug_id>
          
          <creation_ts>2013-01-21 04:48:03 -0800</creation_ts>
          <short_desc>[Soup] Random thread crashes</short_desc>
          <delta_ts>2013-01-22 22:12:53 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKitGTK</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>Gtk, Soup</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>107432</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Sergio Villar Senin">svillar</reporter>
          <assigned_to name="Sergio Villar Senin">svillar</assigned_to>
          <cc>danw</cc>
    
    <cc>gustavo</cc>
    
    <cc>mrobinson</cc>
    
    <cc>rakuco</cc>
    
    <cc>s.choi</cc>
    
    <cc>svillar</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>812035</commentid>
    <comment_count>0</comment_count>
    <who name="Sergio Villar Senin">svillar</who>
    <bug_when>2013-01-21 04:48:03 -0800</bug_when>
    <thetext>GLib (gthread-posix.c): Unexpected error from C library during &apos;pthread_mutex_lock&apos;: Invalid argument.  Aborting.

Program received signal SIGABRT, Aborted.
0x00007ffff016b475 in *__GI_raise (sig=&lt;optimized out&gt;) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
64	../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  0x00007ffff016b475 in *__GI_raise (sig=&lt;optimized out&gt;) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x00007ffff016e6f0 in *__GI_abort () at abort.c:92
#2  0x00007ffff0db020b in g_thread_abort (status=22, function=0x7ffff0e3a52f &quot;pthread_mutex_lock&quot;) at gthread-posix.c:76
#3  0x00007ffff0db0397 in g_mutex_lock (mutex=0x21c1730) at gthread-posix.c:211
#4  0x00007ffff0d60d56 in g_main_context_find_source_by_user_data (context=0x21c1730, user_data=0x77b1a0) at gmain.c:2050
#5  0x00007ffff41feefe in soup_session_real_kick_queue (session=0x77b180) at soup-session.c:2123
#6  0x00007ffff41fefbc in soup_session_kick_queue (session=0x77b180) at soup-session.c:2141
#7  0x00007ffff4201d20 in soup_session_send_async (session=0x77b180, msg=0x2646d90, cancellable=0x227be40, callback=0x7ffff41f641c &lt;http_input_stream_ready_cb&gt;, user_data=0x22de0e0) at soup-session.c:3909
#8  0x00007ffff41f65b9 in soup_request_http_send_async (request=0x22f25e0, cancellable=0x227be40, callback=0x7ffff5e11c70 &lt;WebCore::sendRequestCallback(_GObject*, _GAsyncResult*, void*)&gt;, user_data=0x7fff8853d768) at soup-request-http.c:143
#9  0x00007ffff41f5170 in soup_request_send_async (request=0x22f25e0, cancellable=0x227be40, callback=0x7ffff5e11c70 &lt;WebCore::sendRequestCallback(_GObject*, _GAsyncResult*, void*)&gt;, user_data=0x7fff8853d768) at soup-request.c:244
#10 0x00007ffff5e11ba4 in WebCore::ResourceHandle::start(WebCore::NetworkingContext*) () from ~/opt/gnome3/lib64/libwebkitgtk-3.0.so.0
#11 0x00007ffff5e02931 in WebCore::ResourceHandle::create(WebCore::NetworkingContext*, WebCore::ResourceRequest const&amp;, WebCore::ResourceHandleClient*, bool, bool) () from ~/opt/gnome3/lib64/libwebkitgtk-3.0.so.0
#12 0x00007ffff561ef6c in WebCore::ResourceLoader::start() () from ~/opt/gnome3/lib64/libwebkitgtk-3.0.so.0
#13 0x00007ffff5623f8a in WebCore::ResourceLoadScheduler::servePendingRequests(WebCore::ResourceLoadScheduler::HostInformation*, WebCore::ResourceLoadPriority) () from ~/opt/gnome3/lib64/libwebkitgtk-3.0.so.0
#14 0x00007ffff56244ae in WebCore::ResourceLoadScheduler::scheduleSubresourceLoad(WebCore::Frame*, WebCore::CachedResource*, WebCore::ResourceRequest const&amp;, WebCore::ResourceLoadPriority, WebCore::ResourceLoaderOptions const&amp;) () from ~/opt/gnome3/lib64/libwebkitgtk-3.0.so.0
#15 0x00007ffff55b921c in WebCore::CachedResource::load(WebCore::CachedResourceLoader*, WebCore::ResourceLoaderOptions const&amp;) () from ~/opt/gnome3/lib64/libwebkitgtk-3.0.so.0
#16 0x00007ffff55bedd9 in WebCore::CachedResourceLoader::requestResource(WebCore::CachedResource::Type, WebCore::CachedResourceRequest&amp;) () from ~/opt/gnome3/lib64/libwebkitgtk-3.0.so.0
#17 0x00007ffff55c0658 in WebCore::CachedResourceLoader::requestCSSStyleSheet(WebCore::CachedResourceRequest&amp;) () from ~/opt/gnome3/lib64/libwebkitgtk-3.0.so.0</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>812036</commentid>
    <comment_count>1</comment_count>
    <who name="Sergio Villar Senin">svillar</who>
    <bug_when>2013-01-21 04:49:21 -0800</bug_when>
    <thetext>BTW I can consistently reproduce it just by trying to log in http://twitter.com</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>812044</commentid>
    <comment_count>2</comment_count>
    <who name="Sergio Villar Senin">svillar</who>
    <bug_when>2013-01-21 05:04:32 -0800</bug_when>
    <thetext>OK, so I&apos;ve just realized that it only happens if I&apos;m using the patch for bug 107432.

Dan, is there any problem on mixing async and sync calls for accessing a given stream? (that patch is synchronously closing a stream that have been read asynchronously).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>812151</commentid>
    <comment_count>3</comment_count>
    <who name="Dan Winship">danw</who>
    <bug_when>2013-01-21 07:58:21 -0800</bug_when>
    <thetext>It&apos;s supposed to work... and if it was going to fail, I wouldn&apos;t expect it to fail like this, which looks like a refcounting problem or something... double-check that there isn&apos;t something else wrong in the sync close patch?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>812190</commentid>
    <comment_count>4</comment_count>
    <who name="Sergio Villar Senin">svillar</who>
    <bug_when>2013-01-21 08:26:33 -0800</bug_when>
    <thetext>(In reply to comment #3)
&gt; It&apos;s supposed to work... and if it was going to fail, I wouldn&apos;t expect it to fail like this, which looks like a refcounting problem or something... double-check that there isn&apos;t something else wrong in the sync close patch?

I got some slightly different backtraces, most of them when loading resources synchronously, which requires some push/pop_thread magic. Could it be related to that?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>812545</commentid>
    <comment_count>5</comment_count>
      <attachid>183872</attachid>
    <who name="Justin Schuh">jschuh</who>
    <bug_when>2013-01-21 19:49:56 -0800</bug_when>
    <thetext>Created attachment 183872
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>812547</commentid>
    <comment_count>6</comment_count>
      <attachid>183872</attachid>
    <who name="Justin Schuh">jschuh</who>
    <bug_when>2013-01-21 19:52:40 -0800</bug_when>
    <thetext>Comment on attachment 183872
Patch

Please ignore. I fat-fingered a bug number.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>813103</commentid>
    <comment_count>7</comment_count>
    <who name="Sergio Villar Senin">svillar</who>
    <bug_when>2013-01-22 09:46:41 -0800</bug_when>
    <thetext>OK I found what&apos;s going on. So there was a mixture of things. There is a bug in libsoup which was somehow uncovered by the patch for https://bugs.webkit.org/show_bug.cgi?id=107432.

But I think there is also a bug in our network stack for synchronous requests. We directly stop the inner main loop we create to emulate synchronous requests in didFinishLoading() but we do not check if we have pending sources in that context we create.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>813114</commentid>
    <comment_count>8</comment_count>
      <attachid>184001</attachid>
    <who name="Sergio Villar Senin">svillar</who>
    <bug_when>2013-01-22 09:54:44 -0800</bug_when>
    <thetext>Created attachment 184001
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>813119</commentid>
    <comment_count>9</comment_count>
      <attachid>184001</attachid>
    <who name="Martin Robinson">mrobinson</who>
    <bug_when>2013-01-22 10:04:24 -0800</bug_when>
    <thetext>Comment on attachment 184001
Patch

Okay. This seems reasonable.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>813255</commentid>
    <comment_count>10</comment_count>
      <attachid>184001</attachid>
    <who name="Sergio Villar Senin">svillar</who>
    <bug_when>2013-01-22 11:26:29 -0800</bug_when>
    <thetext>Comment on attachment 184001
Patch

Clearing flags on attachment: 184001

Committed r140445: &lt;http://trac.webkit.org/changeset/140445&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>813256</commentid>
    <comment_count>11</comment_count>
    <who name="Sergio Villar Senin">svillar</who>
    <bug_when>2013-01-22 11:26:35 -0800</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="0"
              isprivate="0"
          >
            <attachid>183872</attachid>
            <date>2013-01-21 19:49:56 -0800</date>
            <delta_ts>2013-01-21 19:52:39 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-107439-20130121194652.patch</filename>
            <type>text/plain</type>
            <size>731</size>
            <attacher name="Justin Schuh">jschuh</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJDb3JlL3BhZ2UvRnJhbWVUcmVlLmgKPT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gU291
cmNlL1dlYkNvcmUvcGFnZS9GcmFtZVRyZWUuaAkocmV2aXNpb24gMTQwMzQ5KQorKysgU291cmNl
L1dlYkNvcmUvcGFnZS9GcmFtZVRyZWUuaAkod29ya2luZyBjb3B5KQpAQCAtMjAsNyArMjAsNiBA
QAogI2lmbmRlZiBGcmFtZVRyZWVfaAogI2RlZmluZSBGcmFtZVRyZWVfaAogCi0jaW5jbHVkZSA8
d3RmL05vdEZvdW5kLmg+CiAjaW5jbHVkZSA8d3RmL3RleHQvQXRvbWljU3RyaW5nLmg+CiAKIG5h
bWVzcGFjZSBXZWJDb3JlIHsKQEAgLTMxLDcgKzMwLDcgQEAgbmFtZXNwYWNlIFdlYkNvcmUgewog
ICAgIGNsYXNzIEZyYW1lVHJlZSB7CiAgICAgICAgIFdURl9NQUtFX05PTkNPUFlBQkxFKEZyYW1l
VHJlZSk7CiAgICAgcHVibGljOgotICAgICAgICBjb25zdCBzdGF0aWMgdW5zaWduZWQgaW52YWxp
ZENvdW50ID0gc3RhdGljX2Nhc3Q8dW5zaWduZWQ+KFdURjo6bm90Rm91bmQpOworICAgICAgICBj
b25zdCBzdGF0aWMgdW5zaWduZWQgaW52YWxpZENvdW50ID0gc3RhdGljX2Nhc3Q8dW5zaWduZWQ+
KC0xKTsKIAogICAgICAgICBGcmFtZVRyZWUoRnJhbWUqIHRoaXNGcmFtZSwgRnJhbWUqIHBhcmVu
dEZyYW1lKSAKICAgICAgICAgICAgIDogbV90aGlzRnJhbWUodGhpc0ZyYW1lKQo=
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>184001</attachid>
            <date>2013-01-22 09:54:44 -0800</date>
            <delta_ts>2013-01-22 11:26:29 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-107439-20130122185137.patch</filename>
            <type>text/plain</type>
            <size>1729</size>
            <attacher name="Sergio Villar Senin">svillar</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMTQwMjQxCmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXggM2MxMWM2MTZkYjVmNjU2
NmEwZjkxMTgwOWJmNjY3NjRmYWYyZm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b3JtL25ldHdvcmsvc291cC9SZXNvdXJjZUhhbmRsZVNvdXAuY3Bw
IGIvU291cmNlL1dlYkNvcmUvcGxhdGZvcm0vbmV0d29yay9zb3VwL1Jlc291cmNlSGFuZGxlU291
cC5jcHAKaW5kZXggYTY0YTQzMDhjNzQyNGMxZDY1OTYwODgzMGY1YmQyYzJjMzVhNjUzNy4uNTdh
YmU5ZWY0MGYxZjI4YmViN2U3Mzk4YTEyMTc5MTE0YTU2NDA5MSAxMDA2NDQKLS0tIGEvU291cmNl
L1dlYkNvcmUvcGxhdGZvcm0vbmV0d29yay9zb3VwL1Jlc291cmNlSGFuZGxlU291cC5jcHAKKysr
IGIvU291cmNlL1dlYkNvcmUvcGxhdGZvcm0vbmV0d29yay9zb3VwL1Jlc291cmNlSGFuZGxlU291
cC5jcHAKQEAgLTExNyw3ICsxMTcsMTIgQEAgcHVibGljOgogICAgIH5XZWJDb3JlU3luY2hyb25v
dXNMb2FkZXIoKQogICAgIHsKICAgICAgICAgYWRqdXN0TWF4Q29ubmVjdGlvbnMoLTEpOwotICAg
ICAgICBnX21haW5fY29udGV4dF9wb3BfdGhyZWFkX2RlZmF1bHQoZ19tYWluX2NvbnRleHRfZ2V0
X3RocmVhZF9kZWZhdWx0KCkpOworCisgICAgICAgIEdNYWluQ29udGV4dCogY29udGV4dCA9IGdf
bWFpbl9jb250ZXh0X2dldF90aHJlYWRfZGVmYXVsdCgpOworICAgICAgICB3aGlsZSAoZ19tYWlu
X2NvbnRleHRfcGVuZGluZyhjb250ZXh0KSkKKyAgICAgICAgICAgIGdfbWFpbl9jb250ZXh0X2l0
ZXJhdGlvbihjb250ZXh0LCBGQUxTRSk7CisKKyAgICAgICAgZ19tYWluX2NvbnRleHRfcG9wX3Ro
cmVhZF9kZWZhdWx0KGNvbnRleHQpOwogICAgICAgICBsb2FkaW5nU3luY2hyb25vdXNSZXF1ZXN0
ID0gZmFsc2U7CiAgICAgfQogCg==
</data>

          </attachment>
      

    </bug>

</bugzilla>