[New-bugs-announce] [issue8094] Multiprocessing infinite loop

Benjamin VENELLE report at bugs.python.org
Tue Mar 9 10:01:54 CET 2010


New submission from Benjamin VENELLE <kain94 at 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 <report at bugs.python.org>
<http://bugs.python.org/issue8094>
_______________________________________


More information about the New-bugs-announce mailing list