WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED WORKSFORME
18044
Timer issues with nested event loops on GTK
https://bugs.webkit.org/show_bug.cgi?id=18044
Summary
Timer issues with nested event loops on GTK
Michael Emmel
Reported
2008-03-24 09:07:34 PDT
It looks like Timer is dropping timers set inside of firing timers. And that it does not correctly handle nested event loops.
Attachments
Patch for silently failing timers
(799 bytes, patch)
2008-03-24 09:08 PDT
,
Michael Emmel
beidson
: review-
Details
Formatted Diff
Diff
Nested event loop patch
(1.77 KB, patch)
2008-03-26 19:52 PDT
,
Michael Emmel
darin
: review-
Details
Formatted Diff
Diff
Removed uneeded fireTimersInNestedEventLoop
(3.67 KB, patch)
2008-03-27 14:31 PDT
,
Michael Emmel
no flags
Details
Formatted Diff
Diff
This patch removes the use of the static timersReadyToFire
(4.41 KB, patch)
2008-04-02 21:58 PDT
,
Michael Emmel
no flags
Details
Formatted Diff
Diff
Patch adds back static after refactoring
(7.44 KB, patch)
2008-04-03 17:24 PDT
,
Michael Emmel
no flags
Details
Formatted Diff
Diff
Same as previous patch with expanded changelog entry
(7.93 KB, patch)
2008-04-03 18:01 PDT
,
Michael Emmel
no flags
Details
Formatted Diff
Diff
Expanded changelog to explain what was changed.
(8.14 KB, patch)
2008-04-03 18:55 PDT
,
Michael Emmel
no flags
Details
Formatted Diff
Diff
Updated patch for nested timers fix
(7.23 KB, patch)
2009-01-20 20:58 PST
,
Aron Rosenberg
no flags
Details
Formatted Diff
Diff
Show Obsolete
(6)
View All
Add attachment
proposed patch, testcase, etc.
Michael Emmel
Comment 1
2008-03-24 09:08:29 PDT
Created
attachment 20007
[details]
Patch for silently failing timers
Brady Eidson
Comment 2
2008-03-24 22:35:12 PDT
Comment on
attachment 20007
[details]
Patch for silently failing timers At a high level, I don't feel qualified to really review this patch - there are a few folks who are intimately familiar with the timer code who would be much safer reviewers. But, I can still make a review decision based on: 1 - Can you provide an example of how this bug is manifesting itself? 2 - Using that real world example/reduction, can a layout test be made? 3 - A Changelog entry is also required
Michael Emmel
Comment 3
2008-03-24 23:01:35 PDT
Is someone responsible for the timer code ? As far as a bug its pretty obvious if your firing a timer the original code silently dropped timers. The code also has another bug I did not fix and its if you change the timer of a timer thats in the list to fire after the one your firing then it does not fire. Most of time this results in a timer continuously reset into the future. I suspect the guard for the timer was and attempt to fix this. By dropping timers you hide this other bug. The answer is the timers or at least the fire times need to be copied in the fire list and it should be local to the function. Any chance that I can talk to a resident expert on this code since it still has a number of problems. I just fixed a obvious problem and also noted the potential advancing timer problem. Thats three with just me reviewing the code. I'd not be surprised if there is one more. So does the code have a resident expert ?
Dave Hyatt
Comment 4
2008-03-25 00:24:29 PDT
Darin is the one who wrote the timer code.
Michael Emmel
Comment 5
2008-03-26 14:18:48 PDT
Hi I emailed Darin no response
Michael Emmel
Comment 6
2008-03-26 14:21:53 PDT
I don't think the future problem actually exists the ready to fire list is not used for the actual firings. So I think just zeroing the list if you remove the last timer solves the problem I'm seeing.
Michael Emmel
Comment 7
2008-03-26 14:28:10 PDT
I take that back it still looks like we will potentially skip timers. I don't think that fireTimersInNestedEventLoop is a real fix. Probably the real answer is setNextFireTime should not remove a timer from the readyToFireList this should only be done after the Timer fires
Michael Emmel
Comment 8
2008-03-26 19:52:09 PDT
Created
attachment 20114
[details]
Nested event loop patch I looked at the log and this is really the same problem that was supposedly fixed by <
rdar://problem/5094895
> REGRESSION (
r19094
) I re factored the patch to make at cleaner and remove the case of someone resetting and removing a timer from the fire list that has not yet fired. Now a timer is only removed from the fire list right before it fires and the fire list is not mutated out side of the shared callback. The special fireTimersInNestedEventLoop is not needed anymore.
Darin Adler
Comment 9
2008-03-27 11:34:53 PDT
Comment on
attachment 20114
[details]
Nested event loop patch Could you fix the formatting of this patch? The comments are not matching the style of the surrounding comments (all lowercase, no space after the //, multiple spaces in one place, no capital letters on the sentences). Could you reword the comments to be clearer and use more straightforward technology? What's a "bool guard"? This sequence seems obviously wrong: + if (timersReadyToFire) + timersReadyToFire->remove(timer); + if(!timersReadyToFire->size()) + timersReadyToFire = 0; If timersReadyToFire is 0, then we're going to crash dereferencing the pointer. I don't understand the change log comment at all. In what sense does this change make anything "generic"? I think this change to the Timer class may be an incorrect workaround for a bug elsewhere. The logic here seems really muddled. The old change gave a special meaning to a timersReadyToFire value of 0. Just setting it to zero because you fired the last timer is not at all consistent with that design. I believe the correct fix is to add a call to fireTimersInNestedEventLoop somewhere.
Michael Emmel
Comment 10
2008-03-27 14:31:30 PDT
Created
attachment 20136
[details]
Removed uneeded fireTimersInNestedEventLoop This patch removes the uneeded and incorrect fireTimersInNestedEventLoop and cleans up the Timer patch. The reason fireTimersInNestedEventLoop is incorrect is that nesting of event loops is done inside the GTK application WebKit cannot correctly determine if its running in a nested event loop set up by the application using the the WebKit widget. So its wrong to not function correctly in nested event loops that may be created using the platform api outside of the scope of WebKit.
Michael Emmel
Comment 11
2008-04-02 21:58:45 PDT
Created
attachment 20307
[details]
This patch removes the use of the static timersReadyToFire This patch completely removes the static variable
Michael Emmel
Comment 12
2008-04-03 17:24:54 PDT
Created
attachment 20321
[details]
Patch adds back static after refactoring This patch is represents the final rewrite of the time code. It adds back a static variable but used only as a guard for stopped or deleted timers. Timers probably should be reference counted.
Michael Emmel
Comment 13
2008-04-03 17:28:58 PDT
Comment on
attachment 20321
[details]
Patch adds back static after refactoring I was hoping the previous patches could spur helpful comments before fully refactoring the code. In any case this is the final patch until after comments.
Michael Emmel
Comment 14
2008-04-03 18:01:38 PDT
Created
attachment 20322
[details]
Same as previous patch with expanded changelog entry Expand change log entry
Michael Emmel
Comment 15
2008-04-03 18:55:25 PDT
Created
attachment 20325
[details]
Expanded changelog to explain what was changed.
Aron Rosenberg
Comment 16
2009-01-20 20:58:16 PST
Created
attachment 26883
[details]
Updated patch for nested timers fix This is an updated patch which takes into account the inspector changes
Martin Robinson
Comment 17
2014-04-08 17:57:12 PDT
Carlos, maybe you can verify whether this can be closed?
Martin Robinson
Comment 18
2015-05-07 16:25:11 PDT
Going to close this since it seems to have dried up. The timer code has changed a lot, but to fix this we need a more modern test case.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug