<?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>22753</bug_id>
          
          <creation_ts>2008-12-09 00:39:25 -0800</creation_ts>
          <short_desc>Reproducible global object leak caused by setInterval</short_desc>
          <delta_ts>2008-12-11 01:05:28 -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>WebCore JavaScript</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://ejohn.org/apps/processing.js/examples/basic/noisewave.html</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>HasReduction, InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Oliver Hunt">oliver</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>darin</cc>
    
    <cc>dimich</cc>
    
    <cc>ggaren</cc>
    
    <cc>mjs</cc>
    
    <cc>sam</cc>
    
    <cc>zwarich</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>101948</commentid>
    <comment_count>0</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2008-12-09 00:39:25 -0800</bug_when>
    <thetext>I have discovered a reproducible global object leak (a valuable property of our GC: when you leak a global object, it takes very little time for maths to become ludicrously expensive and my browsing patterns show tihs really quickly.  Because all i look at are js raytracers :D )

Steps to reproduce:
1. Start webkit
2. Open caches window
3. Navigate to http://ejohn.org/apps/processing.js/examples/basic/noisewave.html
4. Navigate to another page (say google.com)
5. Close browser window
6. Force GC a few times

Results:
We end up with 2 global objects leaked, probably due to the one protected function that hangs around indefinitely. The global object contained by that function, then history probably holds onto all the other global objects, and subsequently everything else.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101949</commentid>
    <comment_count>1</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2008-12-09 00:44:43 -0800</bug_when>
    <thetext>&lt;rdar://problem/6429894&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101950</commentid>
    <comment_count>2</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2008-12-09 00:46:35 -0800</bug_when>
    <thetext>What version of WebKit are you seeing this with?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101951</commentid>
    <comment_count>3</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2008-12-09 00:51:07 -0800</bug_when>
    <thetext>r39131, but i was seeing this from a revision earlier today and updated to verify it still existed in tot</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101954</commentid>
    <comment_count>4</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2008-12-09 02:08:48 -0800</bug_when>
    <thetext>The leaking protected object is a setInterval() callback in processing.js. There is no leak in r38860, so this is likely to be a regression from DOMTimer refactoring.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101956</commentid>
    <comment_count>5</comment_count>
      <attachid>25879</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2008-12-09 02:31:11 -0800</bug_when>
    <thetext>Created attachment 25879
reduction</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101969</commentid>
    <comment_count>6</comment_count>
    <who name="Dmitry Titov">dimich</who>
    <bug_when>2008-12-09 05:21:10 -0800</bug_when>
    <thetext>Not enough calls to stopActiveDOMObjects().
In this case, the suspended CachedPages are cleared when window is closed. This code path never calls stopActiveDOMObjects() and it caused live JS wrappers to stay alive.
After window close, the cached pages are cleared and it seems Document::detach() is a good place to stop active objects. I hope documents can not &apos;attach&apos; back.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101970</commentid>
    <comment_count>7</comment_count>
      <attachid>25883</attachid>
    <who name="Dmitry Titov">dimich</who>
    <bug_when>2008-12-09 05:42:00 -0800</bug_when>
    <thetext>Created attachment 25883
Proposed patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102121</commentid>
    <comment_count>8</comment_count>
    <who name="Dmitry Titov">dimich</who>
    <bug_when>2008-12-10 10:50:40 -0800</bug_when>
    <thetext>Working on a test. Will add as a separate patch.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102135</commentid>
    <comment_count>9</comment_count>
    <who name="Dmitry Titov">dimich</who>
    <bug_when>2008-12-10 13:08:52 -0800</bug_when>
    <thetext>Can&apos;t create a test because DumpRenderTree has the page cache disabled. The known way to repro the leak is when CachedPages are destroyed.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102145</commentid>
    <comment_count>10</comment_count>
      <attachid>25883</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2008-12-10 14:23:41 -0800</bug_when>
    <thetext>Comment on attachment 25883
Proposed patch

Is it correct behavior to stop XMLHttpRequest in this case?

I&apos;ll assume the answer is yes and say r=me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102191</commentid>
    <comment_count>11</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2008-12-10 18:14:21 -0800</bug_when>
    <thetext>Committing to http://svn.webkit.org/repository/webkit/trunk ...
	M	WebCore/ChangeLog
	M	WebCore/dom/Document.cpp
Committed r39193
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102217</commentid>
    <comment_count>12</comment_count>
    <who name="Dmitry Titov">dimich</who>
    <bug_when>2008-12-11 01:05:28 -0800</bug_when>
    <thetext>added a regression test - bug 22806</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>25879</attachid>
            <date>2008-12-09 02:31:11 -0800</date>
            <delta_ts>2008-12-09 02:31:11 -0800</delta_ts>
            <desc>reduction</desc>
            <filename>interval2.html</filename>
            <type>text/html</type>
            <size>280</size>
            <attacher name="Alexey Proskuryakov">ap</attacher>
            
              <data encoding="base64">PGJvZHk+CjxkaXY+PC9kaXY+CjxzY3JpcHQ+CnZhciBwID0ge307CnAuZm9vID0gZnVuY3Rpb24o
KSB7CiAgICBzZXRJbnRlcnZhbChmdW5jdGlvbigpIHt9LCAxMDAwKTsKfQpwLmQgPSBkb2N1bWVu
dC5nZXRFbGVtZW50c0J5VGFnTmFtZSgiZCIpOwpwLmZvbygpOwpsb2NhdGlvbi5ocmVmID0gImRh
dGE6dGV4dC9wbGFpbixQbGVhc2UgY2xvc2UgdGhpcyB3aW5kb3cgYW5kIGNoZWNrIGZvciBwcm90
ZWN0ZWQgb2JqZWN0cyBpbiBDYWNoZXMgd2luZG93LiI7Cjwvc2NyaXB0Pgo8L2JvZHk+Cg==
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>25883</attachid>
            <date>2008-12-09 05:42:00 -0800</date>
            <delta_ts>2008-12-10 14:23:41 -0800</delta_ts>
            <desc>Proposed patch</desc>
            <filename>patch.txt</filename>
            <type>text/plain</type>
            <size>1003</size>
            <attacher name="Dmitry Titov">dimich</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFdlYkNvcmUvQ2hhbmdlTG9n
CShyZXZpc2lvbiAzOTEzMikKKysrIFdlYkNvcmUvQ2hhbmdlTG9nCSh3b3JraW5nIGNvcHkpCkBA
IC0xLDMgKzEsMTQgQEAKKzIwMDgtMTItMDkgIERtaXRyeSBUaXRvdiAgPGRpbWljaEBjaHJvbWl1
bS5vcmc+CisKKyAgICAgICAgUmV2aWV3ZWQgYnkgTk9CT0RZIChPT1BTISkuCisKKyAgICAgICAg
Rml4IG1lbW9yeSBsZWFrIC0gbmVlZCB0byBjYWxsIHN0b3BBY3RpdmVET01PYmplY3RzCisgICAg
ICAgIHdoZW4gY2FjaGVkIHBhZ2VzIGdldCBkZXN0cm95ZWQuCisgICAgICAgIGh0dHBzOi8vYnVn
cy53ZWJraXQub3JnL3Nob3dfYnVnLmNnaT9pZD0yMjc1MworCisgICAgICAgICogZG9tL0RvY3Vt
ZW50LmNwcDoKKyAgICAgICAgKFdlYkNvcmU6OkRvY3VtZW50OjpkZXRhY2gpOiBhZGQgYSBjYWxs
IHRvIHN0b3BBY3RpdmVET01PYmplY3RzKCkKKwogMjAwOC0xMS0yNiAgUGV0ZXIgS2FzdGluZyAg
PHBrYXN0aW5nQGdvb2dsZS5jb20+CiAKICAgICAgICAgUmV2aWV3ZWQgYnkgQW5kZXJzIENhcmxz
c29uLgpJbmRleDogV2ViQ29yZS9kb20vRG9jdW1lbnQuY3BwCj09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFdlYkNv
cmUvZG9tL0RvY3VtZW50LmNwcAkocmV2aXNpb24gMzkwOTkpCisrKyBXZWJDb3JlL2RvbS9Eb2N1
bWVudC5jcHAJKHdvcmtpbmcgY29weSkKQEAgLTEyNzcsNiArMTI3Nyw3IEBAIHZvaWQgRG9jdW1l
bnQ6OmRldGFjaCgpCiAgICAgQVNTRVJUKCFtX2luUGFnZUNhY2hlKTsKIAogICAgIGNsZWFyQVhP
YmplY3RDYWNoZSgpOworICAgIHN0b3BBY3RpdmVET01PYmplY3RzKCk7CiAgICAgCiAgICAgUmVu
ZGVyT2JqZWN0KiByZW5kZXIgPSByZW5kZXJlcigpOwogCg==
</data>
<flag name="review"
          id="12145"
          type_id="1"
          status="+"
          setter="darin"
    />
          </attachment>
      

    </bug>

</bugzilla>