Skip to content

fix(skillfs): prevent FUSE test mount leaks#1329

Open
kongche-jbw wants to merge 1 commit into
alibaba:mainfrom
kongche-jbw:fix/skillfs/fuse-mount-leak-guard
Open

fix(skillfs): prevent FUSE test mount leaks#1329
kongche-jbw wants to merge 1 commit into
alibaba:mainfrom
kongche-jbw:fix/skillfs/fuse-mount-leak-guard

Conversation

@kongche-jbw

Copy link
Copy Markdown
Collaborator

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 under target/tmp.

This PR:

  • Adds 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 4 child.kill() call sites; run_briefly now takes the mountpoint so teardown always targets the mounted path.
  • Adds a bounded, non-panicking, non-blocking force_unmount_path on MountHandle, invoked from both Drop and the unmount() error path so every teardown route is covered.

Related Issue

closes #1328

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • CI/CD or build changes

Scope

  • skillfs (SkillFS)

Checklist

  • My code follows the project's code style
  • I have added tests that prove my fix is effective (reuses existing tests; the target/tmp mount count no longer grows after a run)
  • For skillfs: cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings, and cargo test --workspace pass
  • Lock files are up to date

Testing

  • Verified with the CI-pinned 1.86.0 toolchain: fmt --check / clippy -D warnings / build all clean.
  • cargo +1.86.0 test --test cli_startup_tests — 47 passed; grep -c skillfs /proc/mounts is unchanged before/after (it would increase by 1 before the fix).
  • Re-ran the previously-leaking non_tmp_transport_paths_pass_gate in isolation — no new target/tmp mount appears.

Additional Notes

MountHandle::Drop does 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.

- 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[skillfs] bug: FUSE test mounts are leaked after cargo test

1 participant