fix: GC for debug dump dirs, launcher temp logs, and bili.log.old - #277
Open
ranxianglei wants to merge 1 commit into
Open
fix: GC for debug dump dirs, launcher temp logs, and bili.log.old#277ranxianglei wants to merge 1 commit into
ranxianglei wants to merge 1 commit into
Conversation
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-277Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr277.tgz
npm install -g packageThis comment is automatically updated on each push. |
Owner
Author
|
[bot] Reviewed PR #277 (commit Verification (ran locally on the PR branch):
What I checked in the diff:
Minor notes (non-blocking, no action required):
Ready to merge whenever you are. 🤖 ework agent · vllm-qwen/qwen3.8-27b |
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.
Part B of #255 (split from PR #274, which covers logs only). Closes #275.
Previously nothing was ever cleaned up:
~/.local/state/billion-context/dumps/andraw/were write-only and grew without bound under--debug;bili-proxy-${port}.log(src/launcher.ts) were only process-group-killed, never unlinked;bili.log10MB rotation producedbili.log.old, but the.oldwas never deleted, so old generations accumulated forever.Changes
src/state-gc.ts—gcDebugDir(dir, { maxFiles?, maxBytes? }): FIFO garbage collection by mtime with two bounds (default 500 files / 512 MB) and a per-directory 30 s throttle so the sweep stays off the hot path. Wired into every debug-dump write site insrc/server.ts(raw/INCOMING,dumps/req,raw/REQ/RES, anddumpStreamToFile).src/logger.ts— rotation now deletes the previous.oldgeneration before renaming, keeping at most one.old. This also fixes rotation on Windows, whererenameSynccannot overwrite an existing target.src/launcher.ts—stopProxynow unlinks the owned proxy temp log; a newgcStaleProxyLogs()sweepsos.tmpdir()forbili-proxy-*.logolder than 24 h (a live proxy rewrites its log on every request, so anything older is dead) and is called at the start ofensureProxyRunningto reap orphans left by crashed/killed launchers.Tests
tests/state-gc.test.ts— count/size trimming, throttle, missing dir, subdirectory handling.tests/logger-rotate.test.ts— rotation keeps at most one.oldgeneration.tests/launcher.test.ts—stopProxyunlinks the temp log;gcStaleProxyLogsremoves only stalebili-proxy-*.logfiles.Full suite green: typecheck, 666 tests, build.