Repository navigation
Conversation
|
You can preview 9b34c44 at https://pr43679-9b34c44.ngbuilds.io/. |
9b34c44 to
a98238e
Compare
|
You can preview a98238e at https://pr43679-a98238e.ngbuilds.io/. |
…ministic As explained in angular#43679, currently the generation of the `ngsw.json` SW manifest is non-deterministic and often incorrect. Until we can update to an `@angular/service-worker` version that includes the fix from PR angular#43679, we temporarily work-around the issue by re-generating the `ngsw.json` manifest after `ng build` using the `ngsw-config` binary exposed by `@angular/service-worker`. NOTE: This works around the issue, because the [FileSystem][1] class used by the `ngsw-config` binary happens to be synchronous (unlike the implementation provided by the Angular CLI), thus avoiding the race conditions described in angular#43679. [1]: https://github.com/angular/angular/blob/c721135e370b34c840756bcfb22c8119b4c8c452/packages/service-worker/cli/filesystem.ts#L15
petebacondarwin
left a comment
There was a problem hiding this comment.
I feel like we need some kind of test to prove out this fix??
a98238e to
1ece2cc
Compare
Sigh 😞 There used to be a time when my word was enough 😛 |
1ece2cc to
588a00e
Compare
|
You can preview 588a00e at https://pr43679-588a00e.ngbuilds.io/. |
petebacondarwin
left a comment
There was a problem hiding this comment.
Thanks for the test ❤️ ❤️ ❤️ ❤️
There was a problem hiding this comment.
So this is the key group in this test, right? Since it matches files that should have already been matched by the previous groups.
…ministic (#43687) As explained in #43679, currently the generation of the `ngsw.json` SW manifest is non-deterministic and often incorrect. Until we can update to an `@angular/service-worker` version that includes the fix from PR #43679, we temporarily work-around the issue by re-generating the `ngsw.json` manifest after `ng build` using the `ngsw-config` binary exposed by `@angular/service-worker`. NOTE: This works around the issue, because the [FileSystem][1] class used by the `ngsw-config` binary happens to be synchronous (unlike the implementation provided by the Angular CLI), thus avoiding the race conditions described in #43679. [1]: https://github.com/angular/angular/blob/c721135e370b34c840756bcfb22c8119b4c8c452/packages/service-worker/cli/filesystem.ts#L15 PR Close #43687
588a00e to
be62c33
Compare
…rrect Previously, all asset-groups from `ngsw-config.json` were processed in parallel. For each asset-group, we retrieved all files for the current build, filtered out files that were already matched by other asset-groups, determined which of the remaining files belonged to the current asset-group and generated entries for the `ngsw.json` manifest. This process was susceptible to race conditions when there were files that would be matched by multiple asset-groups. This made the generation of the `ngsw.json` manifest non-deterministic and violated the rule that each file would belong to the first asset-group that matched it (based on the asset-groups' order of appearance in `ngsw-config.json`), thus leading to broken ServiceWorker behavior. This commit fixes it by ensuring that the generation process is deterministic and that asset-groups are processed in the proper order. NOTE 1: The generation process has been broken since the beginning, but we have only noticed this recently. This is possibly related to the CLI's switching from a virtual file system host (which has more consistent timing characteristics) to the Node.js built-in `fs.promises` in angular/angular-cli@d3bc530. NOTE 2: This commit also ensures that files in the `ngsw.json` hash-table are in alphabetic order. Previously, the files were added to the hash-table in blocks corresponding to each asset-group. This change is not necessary (i.e. the order of keys in the hash-table makes no difference in behavior), but it makes it easier to scan for a file (for example, for debugging purposes).
|
This PR was merged into the repository by commit fddb50b. |
…rrect (#43679) Previously, all asset-groups from `ngsw-config.json` were processed in parallel. For each asset-group, we retrieved all files for the current build, filtered out files that were already matched by other asset-groups, determined which of the remaining files belonged to the current asset-group and generated entries for the `ngsw.json` manifest. This process was susceptible to race conditions when there were files that would be matched by multiple asset-groups. This made the generation of the `ngsw.json` manifest non-deterministic and violated the rule that each file would belong to the first asset-group that matched it (based on the asset-groups' order of appearance in `ngsw-config.json`), thus leading to broken ServiceWorker behavior. This commit fixes it by ensuring that the generation process is deterministic and that asset-groups are processed in the proper order. NOTE 1: The generation process has been broken since the beginning, but we have only noticed this recently. This is possibly related to the CLI's switching from a virtual file system host (which has more consistent timing characteristics) to the Node.js built-in `fs.promises` in angular/angular-cli@d3bc530. NOTE 2: This commit also ensures that files in the `ngsw.json` hash-table are in alphabetic order. Previously, the files were added to the hash-table in blocks corresponding to each asset-group. This change is not necessary (i.e. the order of keys in the hash-table makes no difference in behavior), but it makes it easier to scan for a file (for example, for debugging purposes). PR Close #43679
…ministic As explained in angular#43679, currently the generation of the `ngsw.json` SW manifest is non-deterministic and often incorrect. Until we can update to an `@angular/service-worker` version that includes the fix from PR angular#43679, we temporarily work-around the issue by re-generating the `ngsw.json` manifest after `ng build` using the `ngsw-config` binary exposed by `@angular/service-worker`. NOTE: This works around the issue, because the [FileSystem][1] class used by the `ngsw-config` binary happens to be synchronous (unlike the implementation provided by the Angular CLI), thus avoiding the race conditions described in angular#43679. [1]: https://github.com/angular/angular/blob/c721135e370b34c840756bcfb22c8119b4c8c452/packages/service-worker/cli/filesystem.ts#L15
…ministic (#43686) As explained in #43679, currently the generation of the `ngsw.json` SW manifest is non-deterministic and often incorrect. Until we can update to an `@angular/service-worker` version that includes the fix from PR #43679, we temporarily work-around the issue by re-generating the `ngsw.json` manifest after `ng build` using the `ngsw-config` binary exposed by `@angular/service-worker`. NOTE: This works around the issue, because the [FileSystem][1] class used by the `ngsw-config` binary happens to be synchronous (unlike the implementation provided by the Angular CLI), thus avoiding the race conditions described in #43679. [1]: https://github.com/angular/angular/blob/c721135e370b34c840756bcfb22c8119b4c8c452/packages/service-worker/cli/filesystem.ts#L15 PR Close #43686
|
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. |
…rrect (angular#43679) Previously, all asset-groups from `ngsw-config.json` were processed in parallel. For each asset-group, we retrieved all files for the current build, filtered out files that were already matched by other asset-groups, determined which of the remaining files belonged to the current asset-group and generated entries for the `ngsw.json` manifest. This process was susceptible to race conditions when there were files that would be matched by multiple asset-groups. This made the generation of the `ngsw.json` manifest non-deterministic and violated the rule that each file would belong to the first asset-group that matched it (based on the asset-groups' order of appearance in `ngsw-config.json`), thus leading to broken ServiceWorker behavior. This commit fixes it by ensuring that the generation process is deterministic and that asset-groups are processed in the proper order. NOTE 1: The generation process has been broken since the beginning, but we have only noticed this recently. This is possibly related to the CLI's switching from a virtual file system host (which has more consistent timing characteristics) to the Node.js built-in `fs.promises` in angular/angular-cli@d3bc530. NOTE 2: This commit also ensures that files in the `ngsw.json` hash-table are in alphabetic order. Previously, the files were added to the hash-table in blocks corresponding to each asset-group. This change is not necessary (i.e. the order of keys in the hash-table makes no difference in behavior), but it makes it easier to scan for a file (for example, for debugging purposes). PR Close angular#43679
Previously, all asset-groups from
ngsw-config.jsonwere processed in parallel. For each asset-group, we retrieved all files for the current build, filtered out files that were already matched by other asset-groups, determined which of the remaining files belonged to the current asset-group and generated entries for thengsw.jsonmanifest. This process was susceptible to race conditions when there were files that would be matched by multiple asset-groups. This made the generation of thengsw.jsonmanifest non-deterministic and violated the rule that each file would belong to the first asset-group that matched it (based on the asset-groups' order of appearance inngsw-config.json), thus leading to broken ServiceWorker behavior.This commit fixes it by ensuring that the generation process is deterministic and that asset-groups are processed in the proper order.
NOTE 1:
The generation process has been broken since the beginning, but we have only noticed this recently. This is possibly related to the CLI's switching from a virtual file system host (which has more consistent timing characteristics) to the Node.js built-in
fs.promisesin angular/angular-cli@d3bc530.NOTE 2:
This commit also ensures that files in the
ngsw.jsonhash-table are in alphabetic order. Previously, the files were added to the hash-table in blocks corresponding to each asset-group.This change is not necessary (i.e. the order of keys in the hash-table makes no difference in behavior), but it makes it easier to scan for a file (for example, for debugging purposes).
NOTE:
Once AIO is updated to a version that includes this fix, remove this work-around.