Skip to content

Fix FileLock descriptor lifetime - #1662

Open
ShiroKSH wants to merge 2 commits into
trifectatechfoundation:mainfrom
ShiroKSH:fix/file-lock-lifetime
Open

Fix FileLock descriptor lifetime#1662
ShiroKSH wants to merge 2 commits into
trifectatechfoundation:mainfrom
ShiroKSH:fix/file-lock-lifetime

Conversation

@ShiroKSH

@ShiroKSH ShiroKSH commented Aug 1, 2026

Copy link
Copy Markdown

Fixes #1653.

Summary

  • Keep a duplicated File in FileLock instead of a raw descriptor.
  • Add a regression test for releasing a lock after the caller closes its file handle.

Why

FileLock could outlive the File from which it captured a raw descriptor. A later unlock could then operate on a closed or reused descriptor. The duplicated handle keeps the lock's descriptor valid for its full lifetime.

Checks

  • cargo fmt --check
  • cargo metadata --no-deps --format-version 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ensure FileLock doesn't outlive the locked file

1 participant