Closed Bug 1591101 Opened 5 years ago Closed 5 years ago

Non-idle, non-controlling, and unregistered Service Workers may not shutdown properly

Categories

(Core :: DOM: Service Workers, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla72
Tracking Status
firefox72 --- fixed

People

(Reporter: perry, Assigned: perry)

References

(Blocks 1 open bug)

Details

Crash Data

Attachments

(2 files)

Service Worker registrations that are unregistered and have no remaining controlled clients are both removed from the ServiceWorkerManager's mRegistrationInfos map and the mControlledClients map. If such a registration's active worker isn't idle, we'll wait for it to become idle and then terminate it.

This is a problem if there's an ordering like:

  1. An unregistered registration stops controlling clients, but its active worker isn't idle yet.
  2. ServiceWorkerManager begins shutting down Service Workers. It'll miss the registration in 1) because that registration has been removed from ServiceWorkerManager's knowledge.
  3. ServiceWorkerShutdownBlocker won't have an accurate count of the pending workers that are shutting down.
  4. An assertion possibly fires when the registration from 1) tries to terminate too late.

Part of ServiceWorkerManager cleanup involves blocking shutdown until all
Service Workers are shutdown. The ServiceWorkerManager's data won't contain
non-idle Service Workers that are both unregistered and not controlling clients,
however, so it won't be able to shutdown these Service Workers. Fortunately,
such workers will always be scheduled to shutdown once they become idle, so
we can just make them shutdown blockers as soon as they transition into that
state.

Attachment #9104004 - Attachment description: Bug 1591101 - make non-idle Service Workers shutdown blockers when removed from SWM r?asuth → Bug 1591101 - bookkeep orphaned registrations r?asuth
Crash Signature: [@ mozilla::dom::ServiceWorkerShutdownBlocker::WaitOnPromise]
Pushed by pjiang@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6c15753220e0
bookkeep orphaned registrations r=asuth
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla72

I just hit a crash at this assertion when starting a local-built browser (from a m-c pull today, 11/13) in a debug build. I had just created a new profile and told it to start.

This is repeatable with -profilemanager (you don't have to create a new profile)

Flags: needinfo?(perry)

profile manager sadness is bug 1591353, I've cc'ed you.

Flags: needinfo?(perry)
See Also: → 1591353

Hi Perry, is qa needed here? If so, could you provide us with some steps? Thanks!

Flags: needinfo?(perry)

Hi Catalin, I don't think QA is needed for this one. Thanks!

Flags: needinfo?(perry)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: