Repository navigation
Conversation
A canceled request can leave its in-flight ASSETS.fetch unsettled, so the memoized promise in the manifest loader never resolved and every later HTML request in that isolate waited on it forever. Cache the parsed manifest instead, and read it per request until it resolves. createAssetCachePolicy held the same kind of promise, so it now stores the resolved file set.
Member
|
When two cold requests overlap, the first can load the manifest and the second can overwrite the cached file set with an empty set after a 404 rejection, losing cache-control: immutable for some assets. Can you look into this? |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #902
Description
createManifestLoadermemoized the in-flightASSETS.fetchfor/.vite/manifest.jsonin a module-scope promise, so every page render in an isolate awaited the same fetch. Workers scope I/O to the request that starts it, and a canceled request can leave that fetch unsettled. The promise then never resolved,cachedwas never set, and every later HTML request in that isolate waited on it forever.The loader now caches the parsed manifest and fetches it per request until one succeeds.
createAssetCachePolicyheld the same kind of promise for the file set it derives from the manifest, and the generated not-found handlers build that policy once per isolate, so a stall there also stopped static assets from being served. It stores the resolved set now. Cold bursts in a fresh isolate read a small local asset a few extra times, which is the cost of not sharing request-bound I/O.Test
Both new cases use an asset binding whose first call never settles, mirroring a canceled request, then assert that a later request still resolves.
keeps a stalled manifest fetch from blocking later requestscovers the loader,keeps a stalled manifest lookup from blocking later asset requestscovers the cache policy. The two rewritten cases pin the new semantics: the parsed manifest is cached and returned by identity, and a missing or failed fetch still retries on the next request.Against the base branch, the stalled cases time out:
With the fix: