Deadlock when importing a module that creates an IPython client #130

niraj-dudani opened this Issue Jun 24, 2010 · 1 comment


None yet

2 participants


System details:
Dell Inspiron 1545 - Intel Core 2 Duo
Ubuntu 9.10 32 bit
Python 2.6.4 (r264:75706, Dec 7 2009, 18:45:15) [GCC 4.4.1](From Ubuntu repos)
OpenMPI 1.4.2 (Installed from source)
ZopeInterface 3.5.3 (Installed from source)
Twisted 10.0.0 (Installed from source)
Foolscap 0.5.0 (Installed from source)
pyOpenSSL 0.9 (From Ubuntu repos)
nose 0.11.3
IPython 0.10 (Installed from source tarball, not git repo)

(Also reproduced on a CentOS 5.2 system, with pretty much the same software configuration.)

I wrote a python module, which creates a TaskClient inside it. (The purpose was to use IPython's 'map' if available, and revert to serial 'map' if not.)

However, when I try to import this module, Python hangs at the following line:
ipc = client.TaskClient()

I can't see an "upload files" option here, so I'm including simplified scripts below. Also included below is a backtrace from pdb, showing where Python hangs. (When it hangs, it is more like a deadlock, since Python continues to perform some sort of polling).


This script gets a client from IPython. It works fine if it is run by itself:
$ python

However, if it is imported as a module (interactively, or in a script), it hangs:
>>> import ipc

It is assumed that some ipengines are running. It does not matter if the
client requested is a TaskClient or a MultiEngineClient.

from IPython.kernel import client

print "Getting Client..."

ipc = client.TaskClient()

print "Got Client."


import ipc


To trace the problem, use the script '', which only does 'import ipc'.
Running this under pdb, the problem appears to be somewhere under:


-> exec cmd in globals, locals



-> import ipc


-> ipc = client.TaskClient()


-> furl_or_file)


-> return twisted.internet.threads.blockingCallFromThread(reactor, f, _a, *_kw)


We're moving away from twisted, so I'm closing this as it's unlikely to get attention.

@takluyver takluyver closed this Mar 23, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment