[issue7474] multiprocessing.managers.SyncManager managed object creation fails when started outside of invoked file

Eric report at bugs.python.org
Thu Dec 10 21:33:04 CET 2009

New submission from Eric <etzool at hotmail.com>:

I am attempting to create a multiprocessing.SyncManager subclass
instance, register a test class with it, start the manager, and
instantiate the test class.  The example I'm providing here is basically
equivalent, and illustrates the same problem (example code is at the
bottom of this message).

This works without issue as long as the manager is started in the file
you actually invoke from the command line.  Handled in exactly the same
way, however, with the call to the SyncManager instance's start method
made in an included file, attempting to instantiate anything, including
built-in list() and dict() objects, via the manager causes script to
hang indefinitely.

Output on ctrl+c breaking seems to indicate the call may be hanging in
the challenge process.

Invocation and output (starting/started are wrapped around the start()
call; creating/created are wrapped around the manager's registered
object instantiation):

$ python test.py 
^CTraceback (most recent call last):
  File "test.py", line 6, in <module>
    obj = test_manager.TC()
  File "/usr/lib64/python2.6/multiprocessing/managers.py", line 634, in temp
    token, exp = self._create(typeid, *args, **kwds)
  File "/usr/lib64/python2.6/multiprocessing/managers.py", line 532, in
    conn = self._Client(self._address, authkey=self._authkey)
  File "/usr/lib64/python2.6/multiprocessing/connection.py", line 140,
in Client
    answer_challenge(c, authkey)
  File "/usr/lib64/python2.6/multiprocessing/connection.py", line 372,
in answer_challenge
    message = connection.recv_bytes(256)         # reject large message


from test_inc import test_manager

print "creating..."
obj = test_manager.dict()
print "...created"


from multiprocessing.managers import SyncManager

test_manager = SyncManager()	
print "starting..."
print "...started"

Environment: Linux 2.6.28-gentoo-r5 #4 SMP x86_64 Intel(R) Core(TM)2 Duo
CPU T5470 @ 1.60GHz GenuineIntel GNU/Linux

Version: Python 2.6.4

Apologies if this is my failure to understand how the library (or even
Python) works, but it seems quite odd that this would be expected behavior.

components: Extension Modules
messages: 96215
nosy: etzool
severity: normal
status: open
title: multiprocessing.managers.SyncManager managed object creation fails when started outside of invoked file
versions: Python 2.6

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list