Message389843
> Even if that's just swapping the execv call for spawnv(_P_WAIT)
> and then exiting, that's fine by me
Maybe call SuspendThread() on other threads, at least the ones that can be enumerated with the threading module.
> I don't see how its behaviour would change at all, unless we're going
> well out of our way to override the CRT. Which I wouldn't want to see
> us do.
The suggestion was for Python to implement system() and spawnv[e]() using subprocess or _winapi. That would eliminate the problem of leaked handles when subprocess.Popen() is called concurrently with os.system() and os.spawn*(). However, inheritance of file descriptors cannot be reasonably implemented in that case, not without accessing private CRT data (i.e. the internal flags of each file descriptor).
If os.spawn*() has to continue supporting inheritance of file descriptors, then the idea is probably a non-starter. All we can do is hope that the CRT's common spawn code will eventually use PROC_THREAD_ATTRIBUTE_HANDLE_LIST. This feature only protects against leaked handles (particularly important for pipes) if it's used by all concurrent CreateProcessW() calls that inherit handles. |
|
Date |
User |
Action |
Args |
2021-03-30 18:18:06 | eryksun | set | recipients:
+ eryksun, terry.reedy, paul.moore, techtonik, tim.golden, jwilk, docs@python, zach.ware, steve.dower |
2021-03-30 18:18:06 | eryksun | set | messageid: <1617128286.77.0.208583507969.issue19124@roundup.psfhosted.org> |
2021-03-30 18:18:06 | eryksun | link | issue19124 messages |
2021-03-30 18:18:06 | eryksun | create | |
|