fix: bound clearJobs rm so FUSE hidden files cannot hang auto-delete - #618
Open
BetterAndBetterII wants to merge 1 commit into
Open
fix: bound clearJobs rm so FUSE hidden files cannot hang auto-delete#618BetterAndBetterII wants to merge 1 commit into
BetterAndBetterII wants to merge 1 commit into
Conversation
rmSync(recursive) never returns when a leaked download fd leaves .fuse_hidden entries on FUSE, so the cleanup timer is never rearmed. Retry-cap directory deletes, skip a stuck job, and always reschedule.
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
clearJobs()called unboundedrmSync({ recursive: true, force: true }). On a FUSE mount, unlinking a file that still has an open download fd recreates.fuse_hidden*entries, so delete never returns and the auto-delete timer is never armed.This bounds directory deletion, isolates a stuck job so the rest still get removed, and always reschedules cleanup from
finally.Fixes #584
Test plan
bun test tests/helpers/rmBounded.test.ts tests/helpers/clearJobs.test.ts(6 pass)Summary by cubic
Prevents job auto-delete from hanging on FUSE mounts by bounding directory removal and always rearming the cleanup timer. Previously unbounded
rmSync({ recursive: true, force: true })could loop when FUSE recreated.fuse_hidden*; now deletion retries are capped, stuck jobs are isolated, and cleanup is rescheduled reliably.rmBounded(bounded recursive delete): ignoresENOENT, retries directory removal onENOTEMPTYup to a limit, then throws to prevent infinite loops.clearExpiredJobsandstartJobCleanup: deletes output/uploads per job, removes the DB row only on successful deletes, logs and continues on failure, and reschedules fromfinally(with injectablermandschedulefor tests).src/index.tsxwithstartJobCleanupwhenAUTO_DELETE_EVERY_N_HOURS > 0.Written for commit 4daf77b. Summary will update on new commits.