New issue
Advanced search Search tips

Issue 706491 link

Starred by 3 users

Issue metadata

Status: Archived
Owner:
Closed: Jun 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug



Sign in to add a comment

"Operation has failed (unknown reason)" SW installation failures

Project Member Reported by jeffy@google.com, Mar 29 2017

Issue description

Chrome Version: M56, M57
OS: Windows/(all?)

Anecdotally, I've seen an uptick in reports from developers attempting to use trivial service workers that fail installation due to "Operation has failed (unknown reason)"

- https://stackoverflow.com/questions/42682914/service-worker-error-in-chromium
- https://twitter.com/pemrouz/status/846502682705772548
- https://github.com/NekR/offline-plugin/issues/213

One developer explicitly noted that they saw this using Chromium 56.0.2924.76, but others have reported it more recently, after M57 became stable. I'm not sure about the distribution of operating systems, but at least one of the screenshots I saw was from Windows.

In one of the cases (https://twitter.com/pemrouz/status/846816998109667328), using the same browser version but an Incognito window (i.e. new profile) worked around the issue, so perhaps profile corruption is to blame? I found a fixed issue (https://bugs.chromium.org/p/chromium/issues/detail?id=371675) from a while back that detailed similar corruption with the idea that the service worker would automatically recover from it, but perhaps there's been a regression?

What is the expected result?

The service worker successfully installs.

What happens instead?

The service worker installation fails with a "Operation has failed (unknown reason)" and will continue to fail when retried using the same profile.
 
> I'm not sure about the distribution of operating systems, but at least one of the screenshots I saw was from Windows.

Other one (reported on `offline-plugin` repo) is Ubuntu (screenshots here: https://github.com/NekR/offline-plugin/issues/215)

Comment 2 by falken@chromium.org, Mar 30 2017

I'm trying to see where this error could come from.

Are people seeing the error "ServiceWorker failed to install: Operation has failed (unknown reason)" or just "Operation has failed (unknown reason)"?

Uploading a screenshot would give clues and confidence.

Comment 3 by falken@chromium.org, Mar 30 2017

Regarding comment #1, in the linked issue the reporter appears to have a successfully installed service worker.

Comment 4 by jeffy@google.com, Mar 30 2017

There's a screenshot of a failure at https://pbs.twimg.com/media/C79uv5aXgAA_ZWY.jpg

Comment 5 by falken@chromium.org, Mar 30 2017

Cc: nhiroki@chromium.org
Labels: -Pri-3 Pri-2
Owner: falken@chromium.org
Status: Assigned (was: Untriaged)
OK it's not straightforward to see where this comes from.

The error message is from the SERVICE_WORKER_ERROR_FAILED code. I'm trying to trace where this code is generated.

One plausible spot is ServiceWorkerVersion::OnStoppedInternal which fails all pending requests with SERVICE_WORKER_ERROR_FAILED. However, which request would it be here? For register(), it would be either an install request or an activate request.

When an install request fails, we get to ServiceWorkerRegisterJob::OnInstallFailed. However, this function prepends the "ServiceWorker failed to install" string, which does not appear in the screenshot. Therefore, it shouldn't be an install request failing.

When an activate request fails, we ignore the error. So it shouldn't come from that.

A remaining possibility is there is a pending_request_ involved that's not install or activate, but I don't believe that's the case.

There are plenty of cases where ServiceWorkerStorage uses SERVICE_WORKER_ERROR_CODE. I'm suspecting ServiceWorkerStorage.

The register() call creates a ServiceWorkerRegisterJob which first queries ServiceWorkerStorage for an existing registration. If this comes back with SERVICE_WORKER_ERROR_FAILED, the register() promise will reject with this message.

I think the SWStorage failures should be converted to a more specific error message to help us pinpoint this. nhiroki@ is there UMA we can look at for SWStorage failures?




Yeah, we have UMAs around the storage:

- ServiceWorker.Database.* for the registration database operations
- ServiceWorker.DiskCache.* for the script storage operations
- ServiceWorker.Storage.* for resource purging and corruption recovery

More specific error reasons on the registration database are recorded by LevelDBEnv.ServiceWorker.*.

Comment 7 by falken@chromium.org, Mar 30 2017

To those who can repro this: can you try to restart the browser and see if the error persists?

When storage fails, the service worker database is cleared and subsequent operations should succeed, but in some cases the browser might need to restart.

Our metrics for storage failures don't show a recent clear regression.
#3 I just pointed that issue to indicate that the user is on ubuntu. because that's the same use as in https://github.com/NekR/offline-plugin/issues/213 issue (even though different accounts). Also even though SW was installed successfully there, nothing were working there, i.e. no one website with SW was available offline. Given that the user had "Operation has failed (unknown reason)" issue before, it seems to be related.

Also, somewhere there in comments one user mentioned that he saw the same issue but only when DevTools where open. Not sure if that's related though. I can try to find exact comments if needed.
Project Member

Comment 9 by sheriffbot@chromium.org, Jul 21 2017

Labels: Hotlist-Google
Status: Archived (was: Assigned)
Do people still see this? I don't think we can take action on this without a repro.

Sign in to add a comment