http://mxr.mozilla.org/mozilla-central/source/ipc/glue/WindowsMessageLoop.cpp#546 Plugin timeouts for both the parent and the child currently don't account for the possibility that a computer might sleep for an extended period during a WaitForNotify call. If this happens we would likely flush all the child processes. This bug is about figuring out what the issues are and hopefully putting together a fix.
I experience this while playing the game 'crime city' on google+. I leave the game open when putting the computer to sleep and after waking the computer back up I get the plugin crashed notification. The crash signatures are always [@ mozalloc_abort(char const* const) | msvcr80.dll@0xe456 ]
Created attachment 573647 [details] [diff] [review] power monitor base patch Wip of this work. I still have a few things to do- test on mac, break up the patch, and try to work up some tests for this.
Created attachment 578232 [details] [diff] [review] base plus win v.1
Created attachment 578369 [details] [diff] [review] base singleton v.1 bsmedberg, not sure if you're the right reviewer for this, but you seem to own toolkit and this is a new component, so..
Created attachment 578375 [details] [diff] [review] tests update v.1
bsmedberg, should this also get hooked up to the hang monitor? Looks like we might have a similar problem there if the timeout thread happens to exit it's wait before the event loop starts processing events. Probably not a common occurrence but might still happen occasionally. http://mxr.mozilla.org/mozilla-central/source/xpcom/threads/HangMonitor.cpp#52
Comment on attachment 578369 [details] [diff] [review] base singleton v.1 I'm torn about this: for the in-process hang monitor we simply wait twice for half the timeout length (e.g. two 15-second waits for a 30-second timeout), which gives you pretty much all of the reliability you need without something quite this complex. See bug 429592 comment 20 for some details. I've got some minor nitpicks on the patch, but can I get you to comment on the general approach first?
I originally just did up a simple singleton that fired observer events (similar to the old widget code) and added observer support to the channels, and figured that would be it. Then realized child processes didn't have observer service, so had to add the simple callback mechanism. I ended up using that on the channels for both sides of the connection to keep it simple. On chrome side we want this to always run which is conveniently taken care of by the xpcom observer subscription. That's really about it. Platform code should be pretty easy to understand. The current location (toolkit) I just sort of randomly picked, it seemed like the best place. We now have some hal battery code (just landed and was developed in tandem with this code) that duplicates some of the window/mac code. I plan to file a follow up to blend the two together somehow.
Comment on attachment 578369 [details] [diff] [review] base singleton v.1 My point is that I don't think we need this code at all for plugin timeouts. Perhaps we need it elsewhere in which case I can review it more thoroughly, but I'd like to try the simpler approach if possible first.
Created attachment 585874 [details] [diff] [review] timeout patch v.1 Two stage timeout patch. Need to test a bit and push to try.
Created attachment 585887 [details] [diff] [review] timeout patch v.1 Cleaned up with less duplicate code.
Created attachment 586038 [details] [diff] [review] timeout patch v.2 Final patch which passes try. I looked for a way to write an ipdl test for this, but didn't see it. Once we're in a Call or Send we don't break out until both stages of the timeout complete, so there doesn't appear to be a way to test the state of mInTimeoutSecondHalf in the middle. We have hang tests already though which test timeouts which passed on try, so things seem to be working as expected.
https://hg.mozilla.org/mozilla-central/rev/fdc667b43e11 This landed on Saturday but for some reason didn't get closed out.