[New-bugs-announce] [issue3792] Module variable overridden in child processes with multiprocessing

Steve Smith report at bugs.python.org
Sat Sep 6 06:53:06 CEST 2008


New submission from Steve Smith <tarkasteve at gmail.com>:

The process variable 'p' is leaking into sub-processes when using the
multiprocessing modules.  The following code demonstrates the problem:

    import sys
    from multiprocessing import Process

    p = 'Correct'

    def test():
        print "Got 'p' of", p

    if __name__ == '__main__':
        if len(sys.argv) == 2 and sys.argv[1] == '-m':
            p = Process(target=test)
            p.start()
            p.join()
        else:
            test()

Running this in SP and MP mode shows the leakage:

    ssmith$ /opt/python-svn/bin/python mpbug.py 
    Got 'p' of Correct
    ssmith$ /opt/python-svn/bin/python mpbug.py -m
    Got 'p' of <Process(Process-1, started)>

This occurs in both 2.6b3 and trunk.

----------
components: Library (Lib)
messages: 72662
nosy: TarkaSteve
severity: normal
status: open
title: Module variable overridden in child processes with multiprocessing
type: behavior
versions: Python 2.6

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


More information about the New-bugs-announce mailing list