<?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>7274</bug_id>
          
          <creation_ts>2006-02-15 07:37:52 -0800</creation_ts>
          <short_desc>Assertion failure in TimerBase::checkHeapIndex() (Timer.cpp:199) !timerHeap-&gt;isEmpty()</short_desc>
          <delta_ts>2006-02-20 10:19:52 -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>WebKit Misc.</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://www.apple.com/itunes/1billion/</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>mitz</reporter>
          <assigned_to name="Darin Adler">darin</assigned_to>
          <cc>catfish.man</cc>
    
    <cc>darin</cc>
    
    <cc>dvirasoro</cc>
    
    <cc>eric</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>32703</commentid>
    <comment_count>0</comment_count>
    <who name="">mitz</who>
    <bug_when>2006-02-15 07:37:52 -0800</bug_when>
    <thetext>ASSERTION FAILED: !timerHeap-&gt;isEmpty() (WebCore/platform/Timer.cpp:199 void WebCore::TimerBase::checkHeapIndex() const)

#0  0x01c26d20 in WebCore::TimerBase::checkHeapIndex (this=0x1438e3c0) at WebCore/platform/Timer.cpp:199
#1  0x01ada2c0 in WebCore::TimerBase::heapDecreaseKey (this=0x1438e3c0) at WebCore/platform/Timer.cpp:217
#2  0x01c277a4 in WebCore::TimerBase::heapPop (this=0x1438e3c0) at WebCore/platform/Timer.cpp:260
#3  0x01c27840 in WebCore::TimerBase::heapIncreaseKey (this=0x1438e3c0) at WebCore/platform/Timer.cpp:241
#4  0x01ada6bc in WebCore::TimerBase::setNextFireTime (this=0x1438e3c0, newTime=1140015679.7352819) at WebCore/platform/Timer.cpp:294
#5  0x01ada7f0 in WebCore::TimerBase::fireTimers (fireTime=1140015679.7352819, firingTimers=@0xbfffe4c0) at WebCore/platform/Timer.cpp:330
#6  0x01ada8c4 in WebCore::TimerBase::sharedTimerFired () at WebCore/platform/Timer.cpp:350
#7  0x01ad9d40 in WebCore::timerFired () at WebCore/platform/mac/SharedTimerMac.cpp:44
#8  0x90770aec in __CFRunLoopDoTimer ()

The  timer in question had an m_heapIndex of -1 and an oldTime of 2.1174059774237895e-203 in setNextFireTime. (newTime was 1140015679.7352819).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32707</commentid>
    <comment_count>1</comment_count>
    <who name="">mitz</who>
    <bug_when>2006-02-15 08:30:18 -0800</bug_when>
    <thetext>And another one:
ASSERTION FAILED: (*timerHeap)[m_heapIndex] == this (WebCore/platform/Timer.cpp:202 void WebCore::TimerBase::checkHeapIndex() const)

This time m_heapIndex was 0, timerHeap-&gt;size() was 4, but none of the timers in the heap was ==this. oldTime was 6.6921152619080891e-203 and newTime was 1140019944.457437.

Where are those oldTime values coming from?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32722</commentid>
    <comment_count>2</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2006-02-15 10:15:05 -0800</bug_when>
    <thetext>oldTime of 6.6921152619080891e-203 is completely bogus. We should never see a time like this. The value of oldTime is the old value of m_nextFireTime.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32723</commentid>
    <comment_count>3</comment_count>
    <who name="">mitz</who>
    <bug_when>2006-02-15 10:21:42 -0800</bug_when>
    <thetext>Memory smashing? I set a breakpoint on where m_nextFireTime is assigned a value and it was never assigned a non-zero value smaller than 100, yet it did end up having such a value.

The third symptom, again pointing in that direction, is crashing on calling a pure virtual function -- TimerBase::fired() --

(gdb) p *timer
$28 = {
  &lt;Noncopyable&gt; = {&lt;No data fields&gt;}, 
  members of TimerBase: 
  _vptr$TimerBase = 0x0, 
  m_nextFireTime = 2.2833798994238128e-314, 
  m_repeatInterval = 2.2893483626215314e-314, 
  m_heapIndex = 1
}
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32724</commentid>
    <comment_count>4</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2006-02-15 10:29:22 -0800</bug_when>
    <thetext>_vptr$TimerBase = 0x0 means that this is not a good object -- that is a pointer to the vtable and should never be 0.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32745</commentid>
    <comment_count>5</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2006-02-15 13:22:15 -0800</bug_when>
    <thetext>For me, this is easily reproducible with the following steps:
1. Go to http://www.squarefree.com/bookmarklets/webdevel.html
2. Click on &quot;shell&quot; - a new window appears
3. Press Cmd+W to close it

Repeat steps 2 and 3 a few times. Sometimes it&apos;s an assertion failure, sometimes a quit with &quot;pure virtual method called/terminate called without an active exception&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32749</commentid>
    <comment_count>6</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2006-02-15 13:31:52 -0800</bug_when>
    <thetext>I&apos;ll look at this as soon as I can.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32808</commentid>
    <comment_count>7</comment_count>
    <who name="">mitz</who>
    <bug_when>2006-02-15 15:36:17 -0800</bug_when>
    <thetext>I think I figured this out: when a timer is fired in TimerBase::fireTimers it can cause not only itself -- but also a subsequent element in the firingTimers array -- to be deleted. I have observed this in the debugger.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32816</commentid>
    <comment_count>8</comment_count>
      <attachid>6515</attachid>
    <who name="">mitz</who>
    <bug_when>2006-02-15 15:59:17 -0800</bug_when>
    <thetext>Created attachment 6515
Proposed patch

I don&apos;t know how to make a layout test for this bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32846</commentid>
    <comment_count>9</comment_count>
      <attachid>6515</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2006-02-15 16:36:51 -0800</bug_when>
    <thetext>Comment on attachment 6515
Proposed patch

All I can say is ... wow! Thanks. r=me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>33069</commentid>
    <comment_count>10</comment_count>
    <who name="">mitz</who>
    <bug_when>2006-02-16 14:52:11 -0800</bug_when>
    <thetext>*** Bug 7307 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>33256</commentid>
    <comment_count>11</comment_count>
    <who name="">mitz</who>
    <bug_when>2006-02-18 09:52:58 -0800</bug_when>
    <thetext>*** Bug 7256 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>33506</commentid>
    <comment_count>12</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2006-02-20 10:19:52 -0800</bug_when>
    <thetext>*** Bug 7292 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>6515</attachid>
            <date>2006-02-15 15:59:17 -0800</date>
            <delta_ts>2006-02-15 16:36:51 -0800</delta_ts>
            <desc>Proposed patch</desc>
            <filename>7274_r1.patch</filename>
            <type>text/plain</type>
            <size>1256</size>
            <attacher>mitz</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFdlYkNvcmUvQ2hhbmdlTG9n
CShyZXZpc2lvbiAxMjgzN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QorKysgV2ViQ29yZS9wbGF0Zm9ybS9UaW1l
ci5jcHAJKHdvcmtpbmcgY29weSkKQEAgLTE3Niw4ICsxNzYsNyBAQCB2b2lkIFRpbWVyQmFzZTo6
c3RhcnQoZG91YmxlIG5leHRGaXJlSW50CiB2b2lkIFRpbWVyQmFzZTo6c3RvcCgpCiB7CiAgICAg
bV9yZXBlYXRJbnRlcnZhbCA9IDA7Ci0gICAgaWYgKG1fbmV4dEZpcmVUaW1lKQotICAgICAgICBz
ZXROZXh0RmlyZVRpbWUoMCk7CisgICAgc2V0TmV4dEZpcmVUaW1lKDApOwogCiAgICAgQVNTRVJU
KG1fbmV4dEZpcmVUaW1lID09IDApOwogICAgIEFTU0VSVChtX3JlcGVhdEludGVydmFsID09IDAp
Owo=
</data>
<flag name="review"
          id="1623"
          type_id="1"
          status="+"
          setter="darin"
    />
          </attachment>
      

    </bug>

</bugzilla>