You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Redis IT job flakes on L1 cache stale-after-write race #28912
The integration-tests-postgres-elasticsearch-redis CI job has been flaking intermittently across unrelated PRs since early June, failing on different tests each run. Across 4 runs traced, 6 distinct failures share one root cause — a stale read from the in-process L1 entity cache after a write commits.
All share the shape: write succeeds → immediately-following read returns the prior state.
Root cause
Guava LoadingCache puts a returning loader's value into L1 even if invalidate() was called while the loader was running. A concurrent reader that started loading before a write commits can poison L1 with the pre-write value AFTER the writer's invalidate ran. Subsequent reads on the same pod serve stale data until L1 TTL (~30s).
The race is structural and older than #28675. It was partially patched in #28197 (NotFoundCache marker for delete) and #28100 (rename-cascade fix), with the comment in EntityRepository.java:4578-4582 explicitly acknowledging the residual hole. PR #28012 (May 13) added the Redis CI variant that exposes it; PR #28675 (June 5) widened the window with per-entity async indexing + out-of-transaction invalidateCachesAfterStore.
Impact
All PRs running CI inherit the flake regardless of their own changes.
Real users hitting PATCH→GET or DELETE→GET on the same entity under load see stale data for up to 30s.
Fix
PR #28902 — three layered defenses: NotFoundCache check on L1 hit (delete-side), per-entity write-epoch counter the loader checks at end-of-load (update-side), deferred async re-invalidate as backstop.
Activity