fix(skillfs): prevent FUSE test mount leaks#1329
Open
kongche-jbw wants to merge 1 commit into
Open
Conversation
- Stop CLI startup tests leaking FUSE mounts: SIGTERM + force-unmount - Centralize bounded, non-panicking force cleanup in MountHandle::Drop - so every drop(handle) test path unmounts even on fusermount3 failure Signed-off-by: 空澈 <kongche.jbw@alibaba-inc.com>
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.
Description
The tests terminate the foreground mount process with
child.kill()(SIGKILL, which SkillFS cannot catch), so the FUSE mount is never unmounted and leaks undertarget/tmp.This PR:
stop_mount_child: sends SIGTERM so SkillFS takes its normal unmount path, waits a bounded time for graceful exit, then force-unmounts as a fallback (fusermount3 -u/-z/umount -l) and finally SIGKILLs to reap the child. Replaces all 4child.kill()call sites;run_brieflynow takes the mountpoint so teardown always targets the mounted path.force_unmount_pathonMountHandle, invoked from bothDropand theunmount()error path so every teardown route is covered.Related Issue
closes #1328
Type of Change
Scope
skillfs(SkillFS)Checklist
target/tmpmount count no longer grows after a run)skillfs:cargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warnings, andcargo test --workspacepassTesting
fmt --check/clippy -D warnings/ build all clean.cargo +1.86.0 test --test cli_startup_tests— 47 passed;grep -c skillfs /proc/mountsis unchanged before/after (it would increase by 1 before the fix).non_tmp_transport_paths_pass_gatein isolation — no newtarget/tmpmount appears.Additional Notes
MountHandle::Dropdoes not help the SIGKILL case directly (a SIGKILLed process never runs Drop); it is a defensive safeguard for library consumers and in-crate tests. The actual fix for the leak is the SIGTERM change on the test side.