New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(service-worker) Regression with failed cache-busted request. #39775
Labels
area: service-worker
Issues related to the @angular/service-worker package
P2
The issue is important to a large percentage of users, with a workaround
regression
Indicates than the issue relates to something that worked in a previous version
type: bug/fix
Milestone
Comments
gkalpak
added
type: bug/fix
regression
Indicates than the issue relates to something that worked in a previous version
area: service-worker
Issues related to the @angular/service-worker package
P2
The issue is important to a large percentage of users, with a workaround
labels
Nov 20, 2020
gkalpak
added a commit
to gkalpak/angular
that referenced
this issue
Nov 20, 2020
Since 5be4edf, a failing cache-busted request (such as those triggered for fetching an uncached asset) will cause the ServiceWorker to incorrectly enter a degraded `EXISTING_CLIENTS_ONLY` mode. A failing network request could be caused by many reasons, including the client or server being offline, and does not signify a broken ServiceWorker state. This commit fixes the logic in `cacheBustedFetchFromNetwork()` to correctly handle errors in network requests. For more details on the problem and the implemented fix see angular#39775.
gkalpak
added a commit
to gkalpak/angular
that referenced
this issue
Nov 20, 2020
Since 5be4edf, a failing cache-busted request (such as those triggered for fetching an uncached asset) will cause the ServiceWorker to incorrectly enter a degraded `EXISTING_CLIENTS_ONLY` mode. A failing network request could be caused by many reasons, including the client or server being offline, and does not signify a broken ServiceWorker state. This commit fixes the logic in `cacheBustedFetchFromNetwork()` to correctly handle errors in network requests. For more details on the problem and the implemented fix see angular#39775.
gkalpak
added a commit
to gkalpak/angular
that referenced
this issue
Nov 20, 2020
Since 5be4edf, a failing cache-busted network request (such as requests for fetching uncached assets) will cause the ServiceWorker to incorrectly enter a degraded `EXISTING_CLIENTS_ONLY` mode. A failing network request could be caused by many reasons, including the client or server being offline, and does not necessarily signify a broken ServiceWorker state. This commit fixes the logic in `cacheBustedFetchFromNetwork()` to correctly handle errors in network requests. For more details on the problem and the implemented fix see angular#39775. Fixes angular#39775
gkalpak
added a commit
to gkalpak/angular
that referenced
this issue
Nov 23, 2020
Since 5be4edf, a failing cache-busted network request (such as requests for fetching uncached assets) will cause the ServiceWorker to incorrectly enter a degraded `EXISTING_CLIENTS_ONLY` mode. A failing network request could be caused by many reasons, including the client or server being offline, and does not necessarily signify a broken ServiceWorker state. This commit fixes the logic in `cacheBustedFetchFromNetwork()` to correctly handle errors in network requests. For more details on the problem and the implemented fix see angular#39775. Fixes angular#39775
gkalpak
added a commit
to gkalpak/angular
that referenced
this issue
Nov 23, 2020
Since 5be4edf, a failing cache-busted network request (such as requests for fetching uncached assets) will cause the ServiceWorker to incorrectly enter a degraded `EXISTING_CLIENTS_ONLY` mode. A failing network request could be caused by many reasons, including the client or server being offline, and does not necessarily signify a broken ServiceWorker state. This commit fixes the logic in `cacheBustedFetchFromNetwork()` to correctly handle errors in network requests. For more details on the problem and the implemented fix see angular#39775. Fixes angular#39775
AndrewKushnir
pushed a commit
that referenced
this issue
Nov 23, 2020
…9786) Since 5be4edf, a failing cache-busted network request (such as requests for fetching uncached assets) will cause the ServiceWorker to incorrectly enter a degraded `EXISTING_CLIENTS_ONLY` mode. A failing network request could be caused by many reasons, including the client or server being offline, and does not necessarily signify a broken ServiceWorker state. This commit fixes the logic in `cacheBustedFetchFromNetwork()` to correctly handle errors in network requests. For more details on the problem and the implemented fix see #39775. Fixes #39775 PR Close #39786
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
area: service-worker
Issues related to the @angular/service-worker package
P2
The issue is important to a large percentage of users, with a workaround
regression
Indicates than the issue relates to something that worked in a previous version
type: bug/fix
Some recent changes to
AssetGroup
's cacheBustedFetchFromNetwork() (in 5be4edf and 036a2fa) have caused the following regression:Whenever the client is offline,
makeCacheBustedFetch
will betrue
, which will result in making a cache-busted request, which in turn will fail as well (since the client is offline), causing anSwCriticalError
to be thrown. Finally, throwing anSwCriticalError
will cause the ServiceWorker to unnecessarily enter anEXISTING_CLIENTS_ONLY
degraded mode.Here is a description of the logic in
cacheBustedFetchFromNetwork()
.Based on that, there are a 5 basic scenarios that are of interest. For brevity, I will use the following symbols:
response.ok === true
).response.ok === false
).Scenarios:
To give some historical context, here is what was returned on each scenario in the past:
Error
.Error
.SwCriticalError
was introduced (commit 3951098):SwCriticalError
.SwCriticalError
.SwCriticalError
.SwCriticalError
.SwCriticalError
.This last change made the implementation match the logic described in this comment. Upon further inspection (and based on other nearby comments), it doesn't seem desirable to make a cache-busted request when the non-cache-busted one failed.
Therefore, I believe the desired behavior would be to revert to the previous logic (where a cache-busted request is made only if the non-cache-busted one is successful) and add extra logic to port the changes from 036a2fa (which introduced the
SwUnrecoverableStateError
) to non-cache-busted requests.For completeness, below are the current behavior (with commit 036a2fa) and the desired/proposed one. Note that there is additional distinction of failed requests based on the returned HTTP status code (denoted in parenthesis).
SwUnrecoverableStateError
.SwCriticalError
.SwCriticalError
.SwUnrecoverableStateError
.SwCriticalError
.SwUnrecoverableStateError
.SwCriticalError
.SwUnrecoverableStateError
.The text was updated successfully, but these errors were encountered: