Repository navigation
Description
Bug description
With the half strategy, ApplicationCacher::flush() reads the per-domain URL index, forgets the responses it lists, then deletes the index. A request that renders and caches a page between that read and the index delete leaves a responses:<hash> key that no index entry points to. With expiry: null it never ages out, getFromCache() finds it directly by hash, and every later visitor gets that copy until the whole cache store is cleared. Invalidation can't reach it because invalidation only looks at the index.
Expected: a flush leaves no cached page behind, or at worst a tracked one that the next invalidation removes.
On our site invalidation.rules is all, so an hourly import that saves ~586 entries calls flush() ~586 times an hour, and the homepage was served from a seven-week-old copy linking to pages that 404. Only cache:clear or a deploy fixed it.
How to reproduce
halfstrategy,expiry: null,invalidation.rules: all, any cache store.- Under load, save entries repeatedly (each save flushes) while requests for an uncached page keep arriving.
- When a render lands between flush's index read and its index delete, that page's response key stays with no index entry. Later saves flush again but never find it; it is served indefinitely.
Deterministic version: call cachePage() from inside the flush between getUrls() and flushUrls() (or step through with a debugger), then assert the response key still exists and getUrls() is empty.
Logs
No response
Environment
Environment
Laravel Version: 13.42.0
PHP Version: 8.5.12
Composer Version: 2.11.1
Environment: local
Debug Mode: ENABLED
Maintenance Mode: OFF
Timezone: UTC
Locale: en
Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED
Drivers
Broadcasting: null
Cache: redis
Database: sqlite
Logs: stack / daily
Mail: smtp
Queue: sync
Session: redis
Storage
public/storage: NOT LINKED
Livewire
Livewire: v4.4.8
Statamic
Addons: 9
License Key: Not set
Sites: 1
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 6.41.0 PRO
Statamic Addons
jacksleight/statamic-bard-mutator: 3.0.6
jacksleight/statamic-distill: 1.3.1
marcorieser/statamic-livewire: 5.3.4
statamic/podcast-categories: 2.0.0
statamic/seo-pro: 7.16.0
transformstudios/events: 6.2.2
transformstudios/front: 4.0.0
transformstudios/prime: 6.20.1
transformstudios/review: 6.0.0Installation
Fresh statamic/statamic site via CLI
Additional details
Support details above are from a local checkout with static caching off; production runs half with expiry: null and rules: all.
#15084 looks like it fixes exactly this: it takes the URL lock around the flush and wipes the index before deleting pages, so a page cached mid-flush ends up tracked instead of orphaned. Filing so that PR has an issue to close. A dedicated static_cache store is a workaround only for StaticCache::flush(), since StaticCacheManager::flush() wipes that store, but see the separate issue about the invalidator skipping that wipe.
Activity