<?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>12718</bug_id>
          
          <creation_ts>2007-02-09 14:55:11 -0800</creation_ts>
          <short_desc>REGRESSION(r18184): Segmentation fault when loading abc.go.com</short_desc>
          <delta_ts>2007-02-13 13:58:08 -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>Page Loading</component>
          <version>420+</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.4</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://abc.go.com</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar, NeedsReduction, Regression</keywords>
          <priority>P1</priority>
          <bug_severity>Critical</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Grace Kloba">klobag</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>andersca</cc>
    
    <cc>ddkilzer</cc>
    
    <cc>grhowes</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>24608</commentid>
    <comment_count>0</comment_count>
    <who name="Grace Kloba">klobag</who>
    <bug_when>2007-02-09 14:55:11 -0800</bug_when>
    <thetext>Load abc.com with ToT (rev 19542) webkit. Wait until it tries to finish loading all the resources. I got segmentation fault and Safari closed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>24580</commentid>
    <comment_count>1</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2007-02-09 15:28:49 -0800</bug_when>
    <thetext>Confirmed with local debug build of WebKit r19537 with Safari 2.0.4 (419.3) on Mac OS X 10.4.8 (8N1037).

The stack trace does not show WebKit in it, but loading this page does not fail in shipping Safari.  I suspect an over-released ObjC object.

Exception:  EXC_BAD_ACCESS (0x0001)
Codes:      KERN_INVALID_ADDRESS (0x0001) at 0xf3000e17

Thread 0 Crashed:
0   libobjc.A.dylib                	0x90a564c7 objc_msgSend + 23
1   com.apple.Foundation           	0x9265cea5 -[NSURLConnection(NSURLConnectionInternal) _sendCallbacks] + 748
2   com.apple.Foundation           	0x9265cb41 _sendCallbacks + 201
3   com.apple.CoreFoundation       	0x9082afd2 CFRunLoopRunSpecific + 1213
4   com.apple.CoreFoundation       	0x9082ab0e CFRunLoopRunInMode + 61
5   com.apple.HIToolbox            	0x92ddabef RunCurrentEventLoopInMode + 285
6   com.apple.HIToolbox            	0x92dda2fd ReceiveNextEventCommon + 385
7   com.apple.HIToolbox            	0x92dda154 BlockUntilNextEventMatchingListInMode + 81
8   com.apple.AppKit               	0x9327f465 _DPSNextEvent + 572
9   com.apple.AppKit               	0x9327f056 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 137
10  com.apple.Safari               	0x00006cea 0x1000 + 23786
11  com.apple.AppKit               	0x93278ddb -[NSApplication run] + 512
12  com.apple.AppKit               	0x9326cd2f NSApplicationMain + 573
13  com.apple.Safari               	0x0005f54a 0x1000 + 386378
14  com.apple.Safari               	0x0005f471 0x1000 + 386161

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>24539</commentid>
    <comment_count>2</comment_count>
    <who name="">mitz</who>
    <bug_when>2007-02-09 16:15:55 -0800</bug_when>
    <thetext>Here&apos;s what I get with zombies enabled:
2007-02-10 02:05:41.791 Safari[14280] *** Selector &apos;connectionDidFinishLoading:&apos; sent to dealloced instance 0x7df9d00 of class WebCoreResourceHandleAsDelegate.
Break at &apos;-[_NSZombie methodSignatureForSelector:]&apos; to debug.

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>24363</commentid>
    <comment_count>3</comment_count>
    <who name="Maciej Stachowiak">mjs</who>
    <bug_when>2007-02-10 19:14:59 -0800</bug_when>
    <thetext>&lt;rdar://problem/4990049&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>24262</commentid>
    <comment_count>4</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2007-02-11 10:10:52 -0800</bug_when>
    <thetext>Doing a binary search of WebKit nightly builds narrows this down to:

r18187	crashes
r18159	does not crash

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>24229</commentid>
    <comment_count>5</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2007-02-11 11:26:08 -0800</bug_when>
    <thetext>*** Bug 12730 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>24228</commentid>
    <comment_count>6</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2007-02-11 11:28:04 -0800</bug_when>
    <thetext>(In reply to comment #4)
&gt; Doing a binary search of WebKit nightly builds narrows this down to:
&gt; r18187  crashes
&gt; r18159  does not crash

Creating local builds of r1818x, I narrowed this down to the changes in r18184.  I don&apos;t know the loader code well enough at this time to go much further.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>24226</commentid>
    <comment_count>7</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2007-02-11 11:29:37 -0800</bug_when>
    <thetext>(In reply to comment #6)
&gt; Creating local builds of r1818x, I narrowed this down to the changes in r18184.

http://trac.webkit.org/projects/webkit/changeset/18184
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>24189</commentid>
    <comment_count>8</comment_count>
      <attachid>13123</attachid>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2007-02-11 12:52:44 -0800</bug_when>
    <thetext>Created attachment 13123
Patch v1 (no changelog; no test)

This patch fixes the crash, but I haven&apos;t figured out what the lifetime of the WebCoreResourceHandleAsDelegate *delegate object is supposed to be (who retains it and who releases it), nor have I worked on creating a test case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>24097</commentid>
    <comment_count>9</comment_count>
      <attachid>13123</attachid>
    <who name="Maciej Stachowiak">mjs</who>
    <bug_when>2007-02-11 18:12:49 -0800</bug_when>
    <thetext>Comment on attachment 13123
Patch v1 (no changelog; no test)

It&apos;s good to know this solves the crash; on the other hand, using autorelease to resolve lifetime issues is somewhat poor form, as it may only be masking the immediate symptom. It&apos;s getting put into d-&gt;m_delegate, which is a smart pointer, so it should stay alive as long as the ResourceHandle is alive. So that must mean the ResourceHandle actually is getting destroyed too early. How is it that it can get destroyed before connectionDidFinishLoading:?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>24107</commentid>
    <comment_count>10</comment_count>
    <who name="Brady Eidson">beidson</who>
    <bug_when>2007-02-12 00:07:29 -0800</bug_when>
    <thetext>&quot;How is it that it can get destroyed before connectionDidFinishLoading:?&quot;

Only way I can think of is didFailWithError: - that, or being neglectfully overreleased in some other manner</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>24044</commentid>
    <comment_count>11</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2007-02-12 03:39:17 -0800</bug_when>
    <thetext>By overriding [WebCoreResourceHandleAsDelegate release], I&apos;m seeing it be released in four places:


#0	0x014cfb04 in -[WebCoreResourceHandleAsDelegate release] at ResourceHandleMac.mm:432
#1	0x929938cc in -[NSURLConnection(NSURLConnectionInternal) _releaseDelegate]
#2	0x92991ab8 in -[NSURLConnection(NSURLConnectionInternal) _sendCallbacks]


#0	0x014cfb04 in -[WebCoreResourceHandleAsDelegate release] at ResourceHandleMac.mm:432
#1	0x92991ac8 in -[NSURLConnection(NSURLConnectionInternal) _sendCallbacks]


#0	0x014cfb04 in -[WebCoreResourceHandleAsDelegate release] at ResourceHandleMac.mm:432
#1	0x014cff80 in WebCore::ResourceHandle::delegate at ResourceHandleMac.mm:138
#2	0x014d02ac in WebCore::ResourceHandle::start at ResourceHandleMac.mm:103


#0	0x014cfb04 in -[WebCoreResourceHandleAsDelegate release] at ResourceHandleMac.mm:432
#1	0x0185c278 in WebCore::RetainPtr&lt;WebCoreResourceHandleAsDelegate&gt;::operator= at RetainPtr.h:131
#2	0x014cfe8c in WebCore::ResourceHandle::releaseDelegate at ResourceHandleMac.mm:148
#3	0x014d0a24 in WebCore::ResourceHandle::~ResourceHandle at ResourceHandleMac.mm:75
#4	0x0185b9dc in WebCore::Shared&lt;WebCore::ResourceHandle&gt;::deref at Shared.h:52
#5	0x01865b34 in WTF::RefPtr&lt;WebCore::ResourceHandle&gt;::operator= at RefPtr.h:106
#6	0x014fc2a4 in WebCore::SubresourceLoader::didFinishLoading at SubresourceLoader.cpp:191
#7	0x014fa2dc in WebCore::ResourceLoader::didFinishLoading at ResourceLoader.cpp:323
#8	0x014cf7c0 in -[WebCoreResourceHandleAsDelegate connectionDidFinishLoading:] at ResourceHandleMac.mm:367

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>24045</commentid>
    <comment_count>12</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2007-02-12 03:51:28 -0800</bug_when>
    <thetext>By overriding [WebCoreResourceHandleAsDelegate retain], I&apos;m seeing it be
released in 3 places:


#0	0x014cfbac in -[WebCoreResourceHandleAsDelegate retain] at ResourceHandleMac.mm:438
#1	0x0185c244 in WebCore::RetainPtr&lt;WebCoreResourceHandleAsDelegate&gt;::operator= at RetainPtr.h:127
#2	0x014cff64 in WebCore::ResourceHandle::delegate at ResourceHandleMac.mm:137
#3	0x014d0220 in WebCore::ResourceHandle::start at ResourceHandleMac.mm:98


#0	0x014cfbac in -[WebCoreResourceHandleAsDelegate retain] at ResourceHandleMac.mm:438
#1	0x92987da8 in -[NSURLConnection initWithRequest:delegate:priority:]
#2	0x014d0328 in WebCore::ResourceHandle::start at ResourceHandleMac.mm:105


#0	0x014cfbac in -[WebCoreResourceHandleAsDelegate retain] at ResourceHandleMac.mm:438
#1	0x929919cc in -[NSURLConnection(NSURLConnectionInternal) _sendCallbacks]
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>24046</commentid>
    <comment_count>13</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2007-02-12 03:52:23 -0800</bug_when>
    <thetext>(In reply to comment #12)
&gt; By overriding [WebCoreResourceHandleAsDelegate retain], I&apos;m seeing it be
&gt; released in 3 places:
  ^^^^^^^^

...be retained in 3 places (copy-paste error).
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>24047</commentid>
    <comment_count>14</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2007-02-12 03:56:57 -0800</bug_when>
    <thetext>This bug only appears to happen with plug-ins, so my current working theory is that a plug-in registers a callback, then gets destroyed, and the process of destroying the plug-in releases the WebCoreResourceHandleAsDelegate one too many times, causing _sendCallBacks to fail when sending a message to a zombie.

The trick is figuring out the over-release path.  (I actually stepped through the whole www.abc.com page load once with a breakpoint on [WebCoreResourceHandleAsDelegate release] until I got the error, but I didn&apos;t know exactly when it was coming, so I wasn&apos;t paying attention to the call stacks just before the error occurred.  :(
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>23482</commentid>
    <comment_count>15</comment_count>
    <who name="Anders Carlsson">andersca</who>
    <bug_when>2007-02-13 13:58:08 -0800</bug_when>
    <thetext>Committed revision 19612.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>13123</attachid>
            <date>2007-02-11 12:52:44 -0800</date>
            <delta_ts>2007-02-11 18:12:49 -0800</delta_ts>
            <desc>Patch v1 (no changelog; no test)</desc>
            <filename>bug-12718-v1.diff</filename>
            <type>text/plain</type>
            <size>609</size>
            <attacher name="David Kilzer (:ddkilzer)">ddkilzer</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvcGxhdGZvcm0vbmV0d29yay9tYWMvUmVzb3VyY2VIYW5kbGVNYWMubW0K
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PQotLS0gV2ViQ29yZS9wbGF0Zm9ybS9uZXR3b3JrL21hYy9SZXNvdXJjZUhhbmRs
ZU1hYy5tbQkocmV2aXNpb24gMTk1NjUpCisrKyBXZWJDb3JlL3BsYXRmb3JtL25ldHdvcmsvbWFj
L1Jlc291cmNlSGFuZGxlTWFjLm1tCSh3b3JraW5nIGNvcHkpCkBAIC0xMzUsNyArMTM1LDcgQEAg
V2ViQ29yZVJlc291cmNlSGFuZGxlQXNEZWxlZ2F0ZSAqUmVzb3VyYwogICAgIGlmICghZC0+bV9k
ZWxlZ2F0ZSkgewogICAgICAgICBXZWJDb3JlUmVzb3VyY2VIYW5kbGVBc0RlbGVnYXRlICpkZWxl
Z2F0ZSA9IFtbV2ViQ29yZVJlc291cmNlSGFuZGxlQXNEZWxlZ2F0ZSBhbGxvY10gaW5pdFdpdGhI
YW5kbGU6dGhpc107CiAgICAgICAgIGQtPm1fZGVsZWdhdGUgPSBkZWxlZ2F0ZTsKLSAgICAgICAg
W2RlbGVnYXRlIHJlbGVhc2VdOworICAgICAgICBbZGVsZWdhdGUgYXV0b3JlbGVhc2VdOwogICAg
IH0KICAgICByZXR1cm4gZC0+bV9kZWxlZ2F0ZS5nZXQoKTsKIH0K
</data>
<flag name="review"
          id="5090"
          type_id="1"
          status="-"
          setter="mjs"
    />
          </attachment>
      

    </bug>

</bugzilla>