feat(ext-api): OrphanTempFileCleanupHook — boot sweep of orphan gzip-chunk-*.tmp (#1296)#1309
Merged
Merged
Conversation
…chunk-*.tmp (skeleton + first test)
…ssed by custom Executor beans)
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
Summary
OrphanTempFileCleanupHook(SpringApplicationRunner) that deletes orphangzip-chunk-*.tmpfiles older than 1h fromjava.io.tmpdiron boot.loopExecutor(existing virtual-thread pool inLoopExecutorConfig) bounded by a 30sCompletableFuturetimeout — a hungFiles.list()(NFS) cannot block boot indefinitely.LogicExecutor.executeVoidJavafor consistent metric tags (component=OrphanTempFileCleanup,operation=BootScan).@TempDir+ injectedClock+Executor.Why
Disk leak observed 2026-06-16: 293 orphan files, 2.4 GB, mtime 1–7 days.
/tmpis tmpfs sized at RAM/2 (~30 GB). At 8 MB × 30K chunks/day = 240 MB/day leak rate. This hook self-heals on every unclean reboot.First boot on this branch: scanned=139 deleted=139 bytes_freed=29616 — real orphans cleaned.
Design notes
java.io.tmpdir(not/tmp) keeps the hook portable and test-injectable.loopExecutorchosen over Spring Boot's defaultapplicationTaskExecutorbecauseTaskExecutionAutoConfigurationis suppressed when anyExecutorbean exists —LoopExecutorConfig.loopExecutor(a virtual-threadAsyncTaskExecutor) satisfies the same role.Out of scope
Verification
./gradlew :module-external-api:test --tests OrphanTempFileCleanupHookTest→ 7/7 pass./gradlew :module-external-api:compileKotlin compileJava --continue→ successbootRun(port 8181) →[OrphanTempFileCleanup] scanned=139 deleted=139 bytes_freed=29616 failed=0log present on first bootdeleted=1 bytes_freed=24+ file goneCloses #1296
🤖 Generated with Claude Code