Skip to content
Snippets Groups Projects
Commit b5751ea6 authored by Ray Kraesig's avatar Ray Kraesig
Browse files

Bug 1772908 - [6/6] Replace polling in UpdateDriver with use of HandleWatcher...

Bug 1772908 - [6/6] Replace polling in UpdateDriver with use of HandleWatcher on Windows r=application-update-reviewers,bytesized

On Windows and on most flavors of Unix (including Linux, but explicitly
excluding macOS), when we wait for an updater-process to terminate, we
poll for its completion rather than reacting asynchronously to some
OS-provided event. The polling loop is _supposed_ to be async-friendly
and interruptible, in that it enqueues its continuation onto its
thread's event queue, rather than directly and synchronously looping.

Unfortunately, the polling loop doesn't idle between poll attempts.
Instead, it calls `sleep()` (or the moral equivalent) directly within
the posted task, and then enqueues its next continuation at the default
priority before concluding. Since shutdown-time teardown is effectively
an idle-priority task, it will never get to run unless the updater
finishes — so an active updater process will always induce a shutdown
hang.

The best fix for this is almost certainly to just _not_ poll, and
instead set up some listener for whatever asynchronous mechanism each OS
provides for this sort of thing.

For Windows, use `HandleWatcher` to do exactly that. (For other OSes,
kick the can down the road.)

Differential Revision: https://phabricator.services.mozilla.com/D159563
parent b342917f
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment