New submission from Benjamin VENELLE <kai...@gmail.com>:

Hi,

The following code results in an infinite loop -->

# ----
import multiprocessing

def f(m):
        print(m)

p = multiprocessing.Process(target=f, args=('pouet',))
p.start()
# ----

I've firstly think about an issue in my code when Python loads this module so 
I've added a "if __name__ == '__main__':" and it works well. But, with the 
following code Python enters in the same infinite loop -->

proc.py:

# ----
import multiprocessing

def f(m):
        print(m)

class P:
        def __init__(self, msg):
                self.msg = msg
        
        def start(self):
                p = multiprocessing.Process(target=f, args=(self.msg,))
                p.start()
# ----

my_script.py:
# ----
from proc import P

p = P("pouet")
p.start()
# ----

It's like Python loads all parent's process memory space before starting 
process which issues in an infinite call to Process.start() ...

----------
components: Library (Lib)
messages: 100707
nosy: Kain94
severity: normal
status: open
title: Multiprocessing infinite loop
type: crash
versions: Python 3.1

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8094>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to