Repository navigation
pgrep: retry flaky test_thread_ids - #839
Conversation
The test took a single /proc/<pid>/task snapshot from a newly spawned thread. That directory can lag, so the new tid was sometimes missing and the test failed at random in PR CI. Poll until both the main and new thread ids are visible, or fail with the snapshot after two seconds. Fixes uutils#471 Signed-off-by: sarankumar1325 <120080287+sarankumar1325@users.noreply.github.com>
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #839 +/- ##
==========================================
+ Coverage 19.20% 20.13% +0.93%
==========================================
Files 68 68
Lines 10156 10346 +190
Branches 546 552 +6
==========================================
+ Hits 1950 2083 +133
- Misses 8206 8263 +57
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| let new_thread_tid = rustix::thread::gettid().as_raw_nonzero().get() as u64; | ||
| assert!(thread_ids.contains(&(new_thread_tid as usize))); | ||
| let new_thread_tid = rustix::thread::gettid().as_raw_nonzero().get() as usize; | ||
| // /proc/<pid>/task can lag a newly started thread, and a single |
There was a problem hiding this comment.
is it really a lag? the thread is already running when it reads its own task dir
i think it is more readdir skipping entries while other test threads exit concurrently, could you please reword?
The new thread is already running when it reads its own task directory. The miss comes from readdir on /proc/<pid>/task skipping entries while other test threads exit concurrently, not from the directory lagging. Signed-off-by: sarankumar1325 <120080287+sarankumar1325@users.noreply.github.com>
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
|
Thanks for your PR |
Fixes #471.
test_thread_idstook a single/proc/<pid>/tasksnapshot from a newly spawned thread. That directory can lag, so the new tid was sometimes missing and the test failed at random in PR CI (and not on main, where it is rarely retried).The test now polls until both the main and new thread ids are visible, or panics with the snapshot after two seconds. A new
ProcessInformationis built on each try becausethread_ids()caches the walk.cargo +1.88.0 test -p uu_pgrep test_thread_idspassed.