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
[engine] Async getBestSlot NPE races database shutdown instead of throwing the intended DatabaseOperationException #4955
Location:database/async/DatabaseAsyncExecutorImpl.java:283-301 (getBestSlot reads executorThreads.length with no null check) while close()/kill() null it under lifecycleLock. Callers: compact():275-278, scheduleTask(slot=-1):836. The class comment (:60-63) claims readers snapshot the array so they cannot observe a just-nulled array, but getBestSlot snapshots and never null-checks. A compaction scheduled concurrently with close() throws NPE instead of DatabaseOperationException("Async executor has been shut down").
Fix: null-check the snapshot in getBestSlot/getRandomSlot and throw the same DatabaseOperationException as scheduleTask.
Filed from an internal engine deep-audit (2026-07). Traced to source; verify against current main before fixing and add a regression test.
Fixed in #5012 (merged). getBestSlot/getRandomSlot now null-check (and zero-length-check) their executorThreads snapshot and throw the intended DatabaseOperationException('Async executor has been shut down') that scheduleTask already produced for the same race, instead of a raw NullPointerException. Regression test asserts the intended exception for both helpers after kill().
Activity
fix(#4928,#4930,#4931,#4932,#4955): storage/engine robustness bundle (#…
lvca commentedon Jul 6, 2026
Fixed in #5012 (merged). getBestSlot/getRandomSlot now null-check (and zero-length-check) their executorThreads snapshot and throw the intended DatabaseOperationException('Async executor has been shut down') that scheduleTask already produced for the same race, instead of a raw NullPointerException. Regression test asserts the intended exception for both helpers after kill().
review(#5072 r1): positive-case guard for the backstop reset + test r…
fix(#4928,#4930,#4931,#4932,#4955): storage/engine robustness bundle (#…
review(#5072 r1): positive-case guard for the backstop reset + test r…
fix(#6505): a best-effort compaction-scheduling race must not fence t…