Skip to content

Editorial: serialize CacheStorage access on a dedicated parallel queue#1838

Open
monica-ch wants to merge 1 commit into
w3c:mainfrom
monica-ch:queue-task-cachestorage-api
Open

Editorial: serialize CacheStorage access on a dedicated parallel queue#1838
monica-ch wants to merge 1 commit into
w3c:mainfrom
monica-ch:queue-task-cachestorage-api

Conversation

@monica-ch

@monica-ch monica-ch commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Updates to cache-storage-match, cache-storage-has, cache-storage-open, cache-storage-delete, and cache-storage-keys.

Two issues addressed:

  1. Data race on the shared name-to-cache map. Multiple CacheStorage objects across documents/workers share the same underlying map, so ad-hoc "in parallel" blocks that iterate and mutate the map could race. Introduce a dedicated name to cache map parallel queue on the map and route all five methods through it so reads and writes are serialized.
  2. Promise resolution from parallel context. Each method resolved/rejected its promise directly from the parallel block. Wrap the resolves/rejects in a Queue a task on the promise's responsible event loop.

This is part 6/6 of #1740. Also closes #1831 (duplicate). Split out from #1755 for focused review.


Preview | Diff

…arallel queue

Introduce a dedicated parallel queue on the name to cache map and route CacheStorage.match / has / open / delete / keys through it, so that reads and writes on the shared map (across CacheStorage objects in different documents/workers) are serialized. Also queue-a-task for all promise resolutions to avoid touching JS objects from the parallel queue.

Refs: w3c#1740, w3c#1831
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cache and cache-storage algos forgets to queue a task to resolve promise.

2 participants