[New-bugs-announce] [issue18120] multiprocessing: garbage collector fails to GC Pipe() end when spawning child process

spresse1 report at bugs.python.org
Sun Jun 2 19:11:07 CEST 2013


New submission from spresse1:

[Code demonstrating issue attached]

When overloading multiprocessing.Process and using pipes, a reference to a pipe spawned in the parent is not properly garbage collected in the child.  This causes the write end of the pipe to be held open with no reference to it in the child process, and therefore no way to close it.  Therefore, it can never throw EOFError.

Expected behavior:
1. Create a pipe with multiprocessing.Pipe(False)
2. Pass read end to a class which subclasses multiprocessing.Process
3. Close write end in parent process
4. Receive EOFError from read end

Actual behavior:
1. Create a pipe with multiprocessing.Pipe(False)
2. Pass read end to a class which subclasses multiprocessing.Process
3. Close write end in parent process
4. Never receive EOFError from read end

Examining the processes in /proc/[pid]/fds/ indicates that a write pipe is still open in the child process, though none should be.  Additionally, no write pipe is open in the parent process.  It is my belief that this is the write pipe spawned in the parent, and is remaining around incorrectly in the child, though there are no references to it.

Tested on 2.7.3 and 3.2.3

----------
components: Library (Lib)
files: bugon.tar.gz
messages: 190492
nosy: spresse1
priority: normal
severity: normal
status: open
title: multiprocessing: garbage collector fails to GC Pipe() end when spawning child process
versions: Python 2.7, Python 3.2
Added file: http://bugs.python.org/file30448/bugon.tar.gz

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18120>
_______________________________________


More information about the New-bugs-announce mailing list