This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Popen should use pidfd_open to implement a non-busy wait
Type: enhancement Stage:
Components: Library (Lib) Versions: Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: SpecLad, benjamin.peterson, gregory.p.smith, vstinner
Priority: normal Keywords:

Created on 2019-11-21 21:43 by SpecLad, last changed 2022-04-11 14:59 by admin.

Messages (3)
msg357222 - (view) Author: Роман Донченко (SpecLad) * Date: 2019-11-21 21:43
Popen.wait(timeout) is currently implemented on Unix-like systems using a busy wait, since the waitpid system call doesn't have a timeout argument.

On Linux, it's now possible to do better than that. You can create a PID file descriptor using pidfd_create and poll that descriptor with the specified timeout. Popen.wait should make use of that.
msg357223 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-11-21 21:46
os.pidfd_open() was added to Python 3.9. Do you mean pidfd_open()?
msg357225 - (view) Author: Роман Донченко (SpecLad) * Date: 2019-11-21 22:20
Right, of course. I keep confusing it with timerfd_create.
History
Date User Action Args
2022-04-11 14:59:23adminsetgithub: 83069
2019-11-21 22:20:50SpecLadsetmessages: + msg357225
title: Popen should use pidfd_create to implement a non-busy wait -> Popen should use pidfd_open to implement a non-busy wait
2019-11-21 21:46:39vstinnersetnosy: + gregory.p.smith, benjamin.peterson
2019-11-21 21:46:25vstinnersetnosy: + vstinner
messages: + msg357223
2019-11-21 21:43:43SpecLadcreate