Closed Bug 914120 Opened 11 years ago Closed 11 years ago

[Chrome Workers] Chrome workers shouldn't be killed abruptly during shutdown

Categories

(Core :: DOM: Workers, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: Yoric, Unassigned)

References

Details

(Whiteboard: [Async])

During shutdown, we kill Workers, regardless of what they may be doing. For DOM Workers, this is a desired behavior. For Chrome Workers, however, not so much, as Chrome Workers may very well be in the process of doing something important, such as a system call.

At the moment, to save our workers from being killed, we have to spin the event loop from JavaScript during shutdown until we are satisfied that they are done with any important work. That's both ugly and error-prone.

I believe that we should change the behavior to ensure that shutdown does not kill a Chrome Worker while it is handling a message. Rather, shutdown should dispatch a call |shutdown()| on the worker and the worker runtime should wait until that call has been properly handled before proceeding with xpcom thread shutdown.
Note: Current behavior of Chrome Workers could cause data loss with Session Restore. Our fault for misunderstanding the semantics of workers, but this is an example of unintended consequences of this design choice in Chrome Workers.
Just keep in mind that all I/O needs to be done at 'profile-before-change' (before workers shut down).
Actually, it doesn't seem to be so clear - we have profile-before-change and profile-before-change2.

Regardless, are you suggesting that we spin the event loop at profile-before-change (or profile-before-change2) to ensure that off main thread I/O always finishes before we kill chrome workers?
All I/O must complete during 'profile-before-change', spinning the event loop if needed. That is a totally separate problem from whether or not ChromeWorkers get canceled at shutdown.
Good point. I believe that this bug is still valid, but 1/ with a lower priority than I thought; 2/ not for the I/O reasons I mentioned initially.
Let's forget about that bug. We'll reopen it if we realize that it is actually useful.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.