Commit c640edd
committed
transports: use a thread instead of SafeChildWatcher
SafeChildWatcher was removed in 3.14. We used to use this as a fallback
for when we don't have pidfd support in the kernel (or Python stdlib)
under the assumption that we'd never see Python 3.14 on a system with
such an old kernel, but of course this happens with newer Python
versions in containers running on RHEL 8 hosts.
Let's divorce ourselves from the entire concept of ChildWatchers,
dropping our 'qdata' cache for them. Instead, we just try to create a
pidfd each time, and if that fails, start up a thread to call waitpid()
and notify the event loop via call_soon_threadsafe(). This approach is
a simplified form of asyncio.ThreadedChildWatcher from the standard
library, which is what gets used anywhere pidfds aren't available.
We had a test that caused pidfd to return ENOSYS that we started
skipping on newer Python versions to avoid trying to use
SafeChildWatcher in what I imagined to be an impossible configuration.
Bring that back unconditionally (and rename it to remove the reference
to "safe watcher").1 parent 8b39e7a commit c640edd
2 files changed
+21
-39
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| 37 | + | |
| 38 | + | |
36 | 39 | | |
37 | 40 | | |
38 | 41 | | |
| |||
305 | 308 | | |
306 | 309 | | |
307 | 310 | | |
308 | | - | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
309 | 318 | | |
310 | 319 | | |
311 | 320 | | |
312 | 321 | | |
313 | 322 | | |
314 | 323 | | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
| 324 | + | |
321 | 325 | | |
322 | 326 | | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
336 | 335 | | |
337 | 336 | | |
338 | 337 | | |
339 | 338 | | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
| 339 | + | |
352 | 340 | | |
353 | 341 | | |
354 | 342 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
| |||
289 | 288 | | |
290 | 289 | | |
291 | 290 | | |
292 | | - | |
| 291 | + | |
293 | 292 | | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | 293 | | |
300 | 294 | | |
301 | 295 | | |
| |||
0 commit comments