[issue43142] Do not add duplicate FDs to list in duplicate_for_child()

2021-02-05 Thread Sanchit


New submission from Sanchit :

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.

--
components: Library (Lib)
messages: 386546
nosy: sanchit
priority: normal
severity: normal
status: open
title: Do not add duplicate FDs to list in duplicate_for_child()
type: behavior
versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 
<https://bugs.python.org/issue43142>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43142] Do not add duplicate FDs to list in duplicate_for_child()

2021-02-05 Thread Sanchit


Change by Sanchit :


--
keywords: +patch
pull_requests: +23257
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24461

___
Python tracker 
<https://bugs.python.org/issue43142>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43142] Do not add duplicate FDs to list in duplicate_for_child()

2021-02-12 Thread Sanchit


Sanchit  added the comment:

But can you please add this fix in versions 3.8 & beyond?
Thanks!

From: report=bugs.python@roundup.psfhosted.org 
 on behalf of Terry J. Reedy 

Sent: Friday, February 12, 2021 3:43 PM
To: SANCHIT JAIN 
Subject: [issue43142] Do not add duplicate FDs to list in duplicate_for_child()

Terry J. Reedy  added the comment:

3.7 and before only get security fixes.

--
nosy: +davin, pitrou, terry.reedy
versions:  -Python 3.6, Python 3.7

___
Python tracker 
<https://bugs.python.org/issue43142>
___

--

___
Python tracker 
<https://bugs.python.org/issue43142>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21063] Touch up one-line descriptions of modules for module index

2019-11-23 Thread Sanchit Khurana


Change by Sanchit Khurana :


--
pull_requests: +16848
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/17363

___
Python tracker 
<https://bugs.python.org/issue21063>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com