Skip to content

[6.x] Fix half measure static cache serving pages missing from the URL index - #15914

Merged
duncanmcclean merged 1 commit into
6.xfrom
fix-orphaned-static-cache-responses
Nov 16, 2026
Merged

duncanmcclean merged 1 commit into
6.xfrom
fix-orphaned-static-cache-responses

Conversation

@duncanmcclean

@duncanmcclean duncanmcclean commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

This pull request fixes an issue where, with the half measure strategy, a page cached while a flush or invalidation was running would stay cached, and no later invalidation could clear it.

This was happening because the ApplicationCacher forgot responses before their URL index entries, and tracked URLs before their responses were stored. A visitor re-caching a page in between would leave its response stored, but its URL missing from the index, so flush(), invalidateUrl() and invalidateUrls() could never reach it again.

This PR fixes it by making sure a stored response never outlives its index entry:

  • flush() now reads every domain's keys and forgets the URL indexes inside the URLs lock, then forgets the responses. A page re-cached during the loop lands on a fresh index.
  • invalidateUrl() and invalidateUrls() now forget the index entries before the responses.
  • cachePage() now tracks the URL once its response has been stored. If an invalidation runs in between, the worst case is an index entry without a response, which just costs a render.

Amp thread: https://ampcode.com/threads/T-bc731ecc-5236-4cea-8cc5-ad26e5469665

Fixes #15859

@duncanmcclean
duncanmcclean merged commit f835f62 into 6.x Nov 16, 2026
66 checks passed
@duncanmcclean
duncanmcclean deleted the fix-orphaned-static-cache-responses branch November 16, 2026 16:32
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.

Half static cache: a page cached during a flush is orphaned and served forever

2 participants