Open
Bug 234016
Opened 22 years ago
Updated 3 years ago
Incorrect fire sequence for multiple synchronized setInterval timers
Categories
(Core :: DOM: Core & HTML, defect, P5)
Tracking
()
NEW
People
(Reporter: phnixwxz1, Unassigned)
References
Details
Attachments
(2 files, 1 obsolete file)
User-Agent:
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.5) Gecko/20031119
See following:
Reproducible: Always
Steps to Reproduce:
1. load the attached test case in browser
2. press the 'start/stop' button
3. read the result in the textbox
Actual Results:
Some interval timeout fired 1 second early than expected:
timer1Thu Feb 12 2004 22:02:07 GMT+0800
timer2Thu Feb 12 2004 22:02:07 GMT+0800
timer3Thu Feb 12 2004 22:02:07 GMT+0800
timer1Thu Feb 12 2004 22:02:07 GMT+0800
timer2Thu Feb 12 2004 22:02:07 GMT+0800
timer3Thu Feb 12 2004 22:02:07 GMT+0800
timer1Thu Feb 12 2004 22:02:09 GMT+0800
timer2Thu Feb 12 2004 22:02:09 GMT+0800
timer3Thu Feb 12 2004 22:02:09 GMT+0800
timer1Thu Feb 12 2004 22:02:09 GMT+0800
timer2Thu Feb 12 2004 22:02:09 GMT+0800
timer3Thu Feb 12 2004 22:02:10 GMT+0800
timer1Thu Feb 12 2004 22:02:11 GMT+0800
timer2Thu Feb 12 2004 22:02:11 GMT+0800
timer3Thu Feb 12 2004 22:02:11 GMT+0800
timer1Thu Feb 12 2004 22:02:11 GMT+0800
timer2Thu Feb 12 2004 22:02:11 GMT+0800
timer3Thu Feb 12 2004 22:02:11 GMT+0800
timer1Thu Feb 12 2004 22:02:13 GMT+0800
timer2Thu Feb 12 2004 22:02:13 GMT+0800
timer3Thu Feb 12 2004 22:02:13 GMT+0800
timer1Thu Feb 12 2004 22:02:13 GMT+0800
timer2Thu Feb 12 2004 22:02:13 GMT+0800
timer3Thu Feb 12 2004 22:02:13 GMT+0800
timer1Thu Feb 12 2004 22:02:13 GMT+0800
timer2Thu Feb 12 2004 22:02:13 GMT+0800
timer3Thu Feb 12 2004 22:02:15 GMT+0800
Reporter | ||
Comment 1•22 years ago
|
||
Reporter | ||
Comment 2•22 years ago
|
||
I think the problem is caused by the code in xpcom/threads/nsTimerImpl.cpp or
dom/src/base/nsGlobalWindow.cpp.
Fired timers are put into mIdleTimers in nsTimerManager, and then
FireNextIdleTimer is called by the main loop in nsAppShell, and then
nsGlobalWindow will check for expired interval timers and start them again.
Problem is: if multiple interval timers are nearly synchronized, they may be put
into idle timer list almost at the same time. In a single loop calling
FireNextIdleTimer, only one timer will be fetched and removed from the idle
timer list, but nsGlobalWindow will check all timeouts, and reinitialize all of
them, including the timers still in the idle timer list, which are not fired.
Then in the next loop calling FireNextIdleTimer, the next remaining timer is
fired, which has been reinitialized and put into nsTimerThread by
nsGlobalWindow, this will cause the timer reinitialized again and removed from
the nsTimerThread. This caused 2 timer events lost and the following events
fired in incorrect sequence.
![]() |
||
Comment 3•22 years ago
|
||
Sounds like an nsGlobalWindow bug.
Assignee: dougt → general
Component: XPCOM → DOM
QA Contact: ian
Reporter | ||
Comment 4•22 years ago
|
||
More accurate test case, showing the duration between interval fires and the
starting of intervals.
Attachment #141236 -
Attachment is obsolete: true
Comment 5•20 years ago
|
||
This is an automated message, with ID "auto-resolve01".
This bug has had no comments for a long time. Statistically, we have found that
bug reports that have not been confirmed by a second user after three months are
highly unlikely to be the source of a fix to the code.
While your input is very important to us, our resources are limited and so we
are asking for your help in focussing our efforts. If you can still reproduce
this problem in the latest version of the product (see below for how to obtain a
copy) or, for feature requests, if it's not present in the latest version and
you still believe we should implement it, please visit the URL of this bug
(given at the top of this mail) and add a comment to that effect, giving more
reproduction information if you have it.
If it is not a problem any longer, you need take no action. If this bug is not
changed in any way in the next two weeks, it will be automatically resolved.
Thank you for your help in this matter.
The latest beta releases can be obtained from:
Firefox: http://www.mozilla.org/projects/firefox/
Thunderbird: http://www.mozilla.org/products/thunderbird/releases/1.5beta1.html
Seamonkey: http://www.mozilla.org/projects/seamonkey/
Reporter | ||
Comment 6•20 years ago
|
||
This bug still exists in FireFox 1.0.7
Comment 7•20 years ago
|
||
*** Bug 317231 has been marked as a duplicate of this bug. ***
Comment 8•20 years ago
|
||
Confirmed with Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8) Gecko/20051111 Firefox/1.5
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 9•20 years ago
|
||
The fix portion of the contained javascript can simply be placed near the top of any javascript that has this bug. This fix starts up one setInterval timer and calls any others that become registered later by hooking setInterval(). This way, there's only ever one setInterval timer active.
Comment 10•19 years ago
|
||
*** Bug 348323 has been marked as a duplicate of this bug. ***
Comment 11•19 years ago
|
||
As best as I can tell this bug is fixed in current minefield builds.
Reporter | ||
Comment 12•19 years ago
|
||
This bug still exists in Firefox 1.5.0.7 and 2.0.
I guess bug 359573 is caused by this bug.
Reporter | ||
Comment 13•19 years ago
|
||
Verified the in lastest 3.0a1 this bug is fixed:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061105 Minefield/3.0a1
However, bug 359573 still exists, so bug 359573 is not related to this bug.
Reporter | ||
Comment 14•19 years ago
|
||
(In reply to comment #13)
>
> However, bug 359573 still exists, so bug 359573 is not related to this bug.
>
The above statement is not accurate. Please refer to latest comments of bug 359573.
Comment 15•18 years ago
|
||
I can encounter the bug in Firefox 2.0.0.3
I had set interval of 2 minutes. Here is the setInterval log in JSON generated by my extension code.
{"updated":"2007-05-27T10:17:49"}
{"updated":"2007-05-27T10:19:50"}
{"updated":"2007-05-27T10:21:52"}
{"updated":"2007-05-27T10:23:53"}
Reporter | ||
Comment 16•18 years ago
|
||
Please omit the above comments #12 and #14. I'm sorry for the confusions caused by them.
Accurate statements:
1) This bug exists in FireFox 1.0, 1.5 and 2.0 versions;
2) This bug is fixed in trunk;
3) This bug is not related to bug 359573 (currently bug 378830).
Comment 17•18 years ago
|
||
this buy STILL exists. please FIX it; it's a major annoyance when writing javascripts.
Comment 18•18 years ago
|
||
Someone please test the trunk nightly builds, since comment 2 points to the Windows idle timers as the culprit, and those are gone on the trunk.
/be
Comment 19•18 years ago
|
||
Adrian: what browser version are you seeing this in? We no longer use idle timers on the trunk and i don't see this problem. sounds like this should be marked fixed?
Comment 20•18 years ago
|
||
Looks fixed here:
WinXP SP2
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7
Updated•16 years ago
|
Assignee: general → nobody
QA Contact: ian → general
Comment 21•7 years ago
|
||
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046
Move all DOM bugs that haven't been updated in more than 3 years and has no one currently assigned to P5.
If you have questions, please contact :mdaly.
Priority: -- → P5
Assignee | ||
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•