Message386546
While spawning, if a process having code built on top of Python's multiprocessing module calls multiprocessing.reduction.DupFd() (in /Lib/multiprocessing/reduction.py) multiple times on the same File descriptor by mistake, then it ends up invoking duplicate_for_child(fd)) of the class Popen, which, in turn, adds a duplicate FD to a list.
This list is then used in spawnv_passfds() in /Lib/multiprocessing/util.py, which uses that list as an argument in a call of _posixsubprocess.fork_exec().
In Modules/_posixsubprocess.c, checks exist to ensure that all the FDs in the list are unique, positive, and in a sorted order.
If duplicate entries are found, a ValueError: bad value(s) in fds_to_keep exception is raised, and the execution is terminated.
Even if this exception were somehow handled, a developer can't change the aforementioned FD list in Python without breaking modularity.
It's better to let developers get away with calling multiprocessing.reduction.DupFd() (in /Lib/multiprocessing/reduction.py) on by not accepting duplicate entries in the first place, so that spawning a process can be successful. |
|
Date |
User |
Action |
Args |
2021-02-06 05:50:31 | sanchit | set | recipients:
+ sanchit |
2021-02-06 05:50:31 | sanchit | set | messageid: <1612590631.17.0.238793980684.issue43142@roundup.psfhosted.org> |
2021-02-06 05:50:31 | sanchit | link | issue43142 messages |
2021-02-06 05:50:30 | sanchit | create | |
|