Failed to update a ServiceWorker: Not found
Reported by
asa.kus...@gmail.com,
Jun 20 2018
|
||||||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36 Steps to reproduce the problem: Unfortunately I have not been able to reproduce the problem myself, I've only seen it in error logs that are beaconed from our service worker. But I believe I have narrowed it down to these operations: 1. Window client sends a post message to the ServiceWorkerRegistration.active worker. 2. At some point in a postMessage event handler waitUntil promise chain, the service worker calls registration.update() For a very small number of users (less than .1%) the update operation repeatedly throws an error: "Failed to update a ServiceWorker: Not found" What is the expected behavior? The service worker update should not fail My understanding of the update algorithm is that, outside of origin issues (mismatched client, registration origin or unsecure origin), the update algorithm should only fail if there is no waiting or active worker associated with the registration. I don't think either of these cases is happening, since we only send a postMessage to the active worker. Even if the worker was no longer active by the time the message was handled, the registration should still have a waiting or active worker. https://www.w3.org/TR/service-workers-1/#dom-serviceworkerregistration-update Regardless of the outcome, it would be nice to get some better hints from the error message as to what the problem is. What went wrong? I've tried looking at the source code to figure out what could be causing the error. I suspect this may be the origin: https://cs.chromium.org/chromium/src/content/browser/service_worker/service_worker_provider_host.cc?type=cs&sq=package:chromium&g=0&l=940 We don't ever call unregister(), so I don't think this has to do with an unregistered registration. Did this work before? N/A Does this work in other browsers? N/A Chrome version: 67.0.3396.87 Channel: stable OS Version: OS X 10.13.4 Flash Version:
,
Jun 20 2018
,
Jun 20 2018
,
Jun 21 2018
As per comment#0 this issue is not consistently reproducible from reporters end. Hence adding TE-NeedsTriageHelp label for further investigation from dev team and cc'ing owners from code search. Thanks!
,
Jun 21 2018
Thanks for reporting this. Basically the error message indicates that the service worker registration could not be found when the update is executing. I could confirm it happens when calling reg.unregister() in the main resource and call reg.update() in a subframe. If you don't call unregister(), I'm suspecting that it might be able to happen when another registration() is called. However, I'm still not clear about the steps to reproduce it.
,
Jun 21 2018
"another registration() is called. " -> "another navigator.serviceWorker.register() is called"
,
Jun 22 2018
Thanks for the tip, I'll look more into the possibility of a 2nd `register()` call causing the issue. I'm working on trying to create a simple reproduction.
,
Jun 29 2018
,
Jan 9
|
||||||
►
Sign in to add a comment |
||||||
Comment 1 by asa.kus...@gmail.com
, Jun 20 2018