NGPageCache._cacheMap and _allEntries are accessed without synchronization in savePage(), restorePageFromCache(), retainPageWithContextIDInCache(), and retainRootEntry(). Per-entry ReentrantLocks exist but the map structure itself is not thread-safe.
Impact
Concurrent access can cause:
ConcurrentModificationException
- Lost cache entries
- Inconsistent reads
- Memory visibility issues across threads
Symptoms would appear under concurrent load — exactly when a framework most needs to be reliable.
Fix
Either:
- Replace HashMaps with
ConcurrentHashMap, or
- Guard map operations with a lock around the entire critical section (less ergonomic but possibly necessary if multi-map invariants exist)
The comment at line 19 acknowledges the cache is experimental — promote to non-experimental by making it thread-safe.
Severity
Important — concurrency bug that surfaces under load. M2 blocker.
NGPageCache._cacheMapand_allEntriesare accessed without synchronization insavePage(),restorePageFromCache(),retainPageWithContextIDInCache(), andretainRootEntry(). Per-entryReentrantLocks exist but the map structure itself is not thread-safe.Impact
Concurrent access can cause:
ConcurrentModificationExceptionSymptoms would appear under concurrent load — exactly when a framework most needs to be reliable.
Fix
Either:
ConcurrentHashMap, orThe comment at line 19 acknowledges the cache is experimental — promote to non-experimental by making it thread-safe.
Severity
Important — concurrency bug that surfaces under load. M2 blocker.