Commit 0601c94
[Rust] Reap by polling instead of SIGCHLD wakeup
CI caught this on Ubuntu: dropping a client left its CLI process in `Z`
for the full 5s the new test allows. The reaper awaited `Child::wait`,
which on Unix falls back to the SIGCHLD driver once `try_wait` misses —
and the signal registration belongs to the runtime that spawned the
child, not to the reaper's own. The reaper could therefore sleep waiting
for a wakeup that was delivered elsewhere. macOS happened to win the race
locally; Linux did not.
Poll `try_wait` on a short backoff (2ms doubling to 50ms) instead. That
makes the reap independent of which runtime owns the signal
registration, which is the whole premise of running it on its own thread.
It costs a handful of wakeups once per client teardown.
`enable_all()` on the reaper runtime stays load-bearing, now for the
timer rather than the signal driver, and the test that guards it is
unchanged: it reaps a child that is still running at the first check.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0f9d5ac7-9999-4f37-82b3-a5533bfbc1f61 parent 17b1a7f commit 0601c94
1 file changed
Lines changed: 36 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
171 | 172 | | |
172 | 173 | | |
173 | 174 | | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
| |||
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
245 | 253 | | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
246 | 257 | | |
247 | | - | |
248 | | - | |
249 | | - | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
250 | 275 | | |
251 | 276 | | |
252 | 277 | | |
| |||
635 | 660 | | |
636 | 661 | | |
637 | 662 | | |
638 | | - | |
639 | | - | |
640 | | - | |
641 | | - | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
642 | 667 | | |
643 | 668 | | |
644 | 669 | | |
| |||
0 commit comments