[#310] Background cleanup of removed entries is disabled even if ChronicleMapBuilder#cleanupRemovedEntries is true - #610
Draft
peter-lawrey wants to merge 1 commit into
Conversation
Wait out the cleanup thread startup delay instead of terminating before the first scan. Pass the remaining relative duration to parkNanos so valid sub-millisecond cleanup intervals cannot stall after one cycle. Stop and join the cleaner before Chronicle Map releases registered contexts. Bound the join by the segment-lock timeout, preserve caller interrupt status, and fail without releasing resources if the cleaner cannot exit safely. Add deterministic coverage for background tombstone removal, repeated microsecond cleanup cycles, relative nanosecond sleeping, close ordering, interruption, and the bounded timeout path. Fixes #310
peter-lawrey
force-pushed
the
fix/Chronicle-Map-310-remove-shutdown-insensitive-early
branch
from
August 22, 2026 11:00
12287ca to
e2efe0d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
The removed-entry cleanup thread no longer exits before doing work, and map close now interrupts and joins that thread before the base close path inspects or releases map contexts. Head:
12287ca6.Why
Activating the previously dormant thread exposed a lifecycle race: close could release the cleanup thread's iteration context during a segment scan, causing cleanup lock errors and
MemoryLeaksTestnull dereferences. The thread must stop before context teardown.Impact
Configured tombstone cleanup runs, while explicit close and cleaner-based resource release retain their existing safety guarantees.
Review status
Draft — coherent local fix, awaiting maintainer review.
Validation
mvn -o -B -Dtest=OldDeletedEntriesCleanupTest,MemoryLeaksTest -Dsurefire.failIfNoSpecifiedTests=false test: 17 tests passed.mvn -o -B clean test: 1,317 tests, 82 skipped, no failures/errors at12287ca6in 1:36.git diff --check: passed.Tracking
Fixes #310.