Skip to content

ThreadLock::new — use RAII for ptrace detach cleanup (#117)#118

Open
charles-dyfis-net wants to merge 1 commit into
benfred:masterfrom
charles-dyfis-net:issue-117
Open

ThreadLock::new — use RAII for ptrace detach cleanup (#117)#118
charles-dyfis-net wants to merge 1 commit into
benfred:masterfrom
charles-dyfis-net:issue-117

Conversation

@charles-dyfis-net

Copy link
Copy Markdown

Construct ThreadLock { tid } immediately after a successful ptrace::seize so that Drop becomes responsible for detach on every exit path, including ? propagation. Closes all three error paths listed in #117 with a single change.

@benfred benfred added the bug Something isn't working label Apr 16, 2026
@benfred

benfred commented Apr 16, 2026

Copy link
Copy Markdown
Owner

Thanks for the change! I like the core fix here - but running the new test locally and I'm seeing some intermittent failures on my local ubuntu machine (fails maybe 1/8th of the time for me). The failures look like


running 5 tests
test tests::test_copy_pointer ... ok
test tests::test_copy_struct ... ok
test linux::test_parse_active_stat ... ok
test linux::test_parse_ppid_stat ... ok
test linux::test_threadlock_leak_on_waitpid_eintr ... FAILED

failures:

---- linux::test_threadlock_leak_on_waitpid_eintr stdout ----

thread 'linux::test_threadlock_leak_on_waitpid_eintr' (111640) panicked at src/linux/mod.rs:459:9:
seize leaked: first=NixError(EINTR), second=NixError(EPERM)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    linux::test_threadlock_leak_on_waitpid_eintr

test result: FAILED. 4 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.04s

error: test failed, to rerun pass `--lib`

@benfred

benfred commented Apr 16, 2026

Copy link
Copy Markdown
Owner

btw, I think the GHA build failure is unrelated to this PR and I will fix this up in a separate PR

Construct `ThreadLock { tid }` immediately after a successful `ptrace::seize` so that `Drop` becomes responsible for detach on every exit path, including `?` propagation. Closes all three error paths listed in benfred#117 with a single change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants