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.

Author sanchit
Recipients sanchit
Date 2021-02-06.05:50:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1612590631.17.0.238793980684.issue43142@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2021-02-06 05:50:31sanchitsetrecipients: + sanchit
2021-02-06 05:50:31sanchitsetmessageid: <1612590631.17.0.238793980684.issue43142@roundup.psfhosted.org>
2021-02-06 05:50:31sanchitlinkissue43142 messages
2021-02-06 05:50:30sanchitcreate