[issue42752] multiprocessing Queue leaks a file descriptor associated with the pipe writer (#33081 still a problem)

mattip report at bugs.python.org
Fri Jan 1 01:35:59 EST 2021


mattip <matti.picus at gmail.com> added the comment:

Just to be clear, here is the code from the test (how do you format a code block here?) that demonstrates the writer is not closed when nothing is put into the queue

```
$ python3
Python 3.8.6 | packaged by conda-forge | (default, Oct  7 2020, 19:08:05) 
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import multiprocessing
>>> q = multiprocessing.Queue()
>>> q.close()
>>> q.join_thread()
>>> q._reader.closed
True
>>> q._writer.closed
False
>>> 

```
And the changed behaviour to close the writer if the queue is used

```
>>> q = multiprocessing.Queue()
>>> q.put(1)
>>> q.get()
1
>>> q.close()
>>> q.join_thread()
>>> q._reader.closed
True
>>> q._writer.closed
True

```

----------
nosy: +mattip

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42752>
_______________________________________


More information about the Python-bugs-list mailing list