[New-bugs-announce] [issue33081] multiprocessing Queue leaks a file descriptor associated with the pipe writer

Henrique Andrade report at bugs.python.org
Thu Mar 15 14:05:17 EDT 2018


New submission from Henrique Andrade <hcma at unscrambl.com>:

A simple example like such demonstrates that one of the file descriptors associated with the underlying pipe will be leaked:

>>> from multiprocessing.queues import Queue
>>> x = Queue()
>>> x.close()

Right after the queue is created we get (assuming the Python interpreter is associated with pid 8096 below):

> ll /proc/8096/fd
total 0
dr-x------ 2 hcma hcma  0 2018-03-15 14:03:23.210089578 -0400 .
dr-xr-xr-x 9 hcma hcma  0 2018-03-15 14:03:23.190089760 -0400 ..
lrwx------ 1 hcma hcma 64 2018-03-15 14:03:33.145998954 -0400 0 -> /dev/pts/25
lrwx------ 1 hcma hcma 64 2018-03-15 14:03:33.145998954 -0400 1 -> /dev/pts/25
lrwx------ 1 hcma hcma 64 2018-03-15 14:03:23.210089578 -0400 2 -> /dev/pts/25
lr-x------ 1 hcma hcma 64 2018-03-15 14:03:33.145998954 -0400 3 -> pipe:[44076946]
l-wx------ 1 hcma hcma 64 2018-03-15 14:03:33.145998954 -0400 4 -> pipe:[44076946]
lr-x------ 1 hcma hcma 64 2018-03-15 14:03:33.145998954 -0400 5 -> /dev/urandom

After close():

> ll /proc/8096/fd
total 0
dr-x------ 2 hcma hcma  0 2018-03-15 14:03:23.210089578 -0400 .
dr-xr-xr-x 9 hcma hcma  0 2018-03-15 14:03:23.190089760 -0400 ..
lrwx------ 1 hcma hcma 64 2018-03-15 14:03:33.145998954 -0400 0 -> /dev/pts/25
lrwx------ 1 hcma hcma 64 2018-03-15 14:03:33.145998954 -0400 1 -> /dev/pts/25
lrwx------ 1 hcma hcma 64 2018-03-15 14:03:23.210089578 -0400 2 -> /dev/pts/25
lr-x------ 1 hcma hcma 64 2018-03-15 14:03:33.145998954 -0400 3 -> pipe:[44076946]
l-wx------ 1 hcma hcma 64 2018-03-15 14:03:33.145998954 -0400 4 -> pipe:[44076946]
lr-x------ 1 hcma hcma 64 2018-03-15 14:03:33.145998954 -0400 5 -> /dev/urandom

----------
components: Library (Lib)
messages: 313899
nosy: Henrique Andrade
priority: normal
severity: normal
status: open
title: multiprocessing Queue leaks a file descriptor associated with the pipe writer
versions: Python 2.7

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


More information about the New-bugs-announce mailing list