Skip to content
This repository has been archived by the owner on Sep 19, 2018. It is now read-only.

Discourage race condition in Service Workers #248

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jugglinmike
Copy link
Contributor

@jugglinmike jugglinmike commented Mar 11, 2017

Invoke the ExtendableEvent's waitUntil method in order to discourage
user agents from terminating service workers while asynchronous tests
are running (which would interfere with test execution). Although the
user agent is still free to terminate workers when execution "exceeds
imposed time limits," this precaution should prevent interference for
the most common cases.

2.1.1. Lifetime

The lifetime of a service worker is tied to the execution lifetime of
events and not references held by service worker clients to the
ServiceWorker object.

A user agent may terminate service workers at any time it:

  • Has no event to handle.
  • Detects abnormal operation: such as infinite loops and tasks exceeding
    imposed time limits (if any) while handling the events.

https://w3c.github.io/ServiceWorker/#service-worker-lifetime

@mkruisselbrink @mattto @wanderview Does this seem reasonable to you?


This change is Reviewable

Invoke the ExtendableEvent's `waitUntil` method in order to discourage
user agents from terminating service workers while asynchronous tests
are running (which would interfere with test execution). Although the
user agent is still free to terminate workers when execution "exceeds
imposed time limits," this precaution should prevent interference for
the most common cases.

> # 2.1.1. Lifetime
>
> The lifetime of a service worker is tied to the execution lifetime of
> events and not references held by service worker clients to the
> ServiceWorker object.
>
> A user agent may terminate service workers at any time it:
>
> - Has no event to handle.
> - Detects abnormal operation: such as infinite loops and tasks exceeding
>   imposed time limits (if any) while handling the events.

https://w3c.github.io/ServiceWorker/#service-worker-lifetime
@jugglinmike
Copy link
Contributor Author

After some discussion on the public-webapps mailing list, I've requested feedback on this general pattern in the Service Worker specification's issue tracker:

w3c/ServiceWorker#1087

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant