Message346332
subprocess keeps the list of active processes in its `_active` list. Whenever you try to Popen a new process, it is immediately (like right in the first line of Popen.__init__ [1]) trying to go clean up the old ones. If one of the processes in that list is gone, then
```
(_WaitForSingleObject(self._handle, 0)
```
[2] will get `OSError: [WinError 6] The handle is invalid` and will prevent you from creating any new processes with Popen after that, because the line where that handle is removes from _active list is not reached. On *nix [3] _internal_poll will actually try-except waitpid and will catch OSError without re-raising it, so if the process is gone, it will simply report it as dead and successfully remove it from _active list. It seems like we should do the same thing on Windows and if we catch `The handle is invalid` error, just report that process as dead and remove it from _active list.
[1] https://github.com/python/cpython/blob/v3.8.0b1/Lib/subprocess.py#L715
[2] https://github.com/python/cpython/blob/v3.8.0b1/Lib/subprocess.py#L1310
[3] https://github.com/python/cpython/blob/v3.8.0b1/Lib/subprocess.py#L1710 |
|
Date |
User |
Action |
Args |
2019-06-23 18:42:24 | efiop | set | recipients:
+ efiop, paul.moore, tim.golden, zach.ware, steve.dower |
2019-06-23 18:42:24 | efiop | set | messageid: <1561315344.64.0.509844893886.issue37380@roundup.psfhosted.org> |
2019-06-23 18:42:24 | efiop | link | issue37380 messages |
2019-06-23 18:42:24 | efiop | create | |
|