[IPython-dev] ZMQError: Too many open files

dave.hirschfeld dave.hirschfeld at gmail.com
Tue Jan 10 15:56:11 EST 2012


I've been testing out the *awesome* parallel capabilities of the new
IPython but was continuously getting the "Too many open files"
ZMQError:

C:\dev\bin\Python27\lib\site-packages\ipython-0.12.beta-py2.7.egg\IPython\parallel\client\client.pyc
  in __init__(self, url_or_file, profile, profile_dir, ipython_dir,
context, debug, exec_key, sshserver, sshkey, password, paramiko,
timeout, **extra_args)
    384         self._queue_handlers = {'execute_reply' :
self._handle_execute_reply,
    385                                 'apply_reply' :
self._handle_apply_reply}
--> 386         self._connect(sshserver, ssh_kwargs, timeout)
    387
    388     def __del__(self):

C:\dev\bin\Python27\lib\site-packages\ipython-0.12.beta-py2.7.egg\IPython\parallel\client\client.pyc
  in _connect(self, sshserver, ssh_kwargs, timeout)

    516             if content.control:
--> 517                 self._control_socket = self._context.socket(zmq.DEALER)
    518                 self._control_socket.setsockopt(zmq.IDENTITY, ident)
    519                 connect_socket(self._control_socket, content.control)

C:\dev\bin\Python27\lib\site-packages\zmq\core\context.pyd
  in zmq.core.context.Context.socket (zmq\core\context.c:1834)()

C:\dev\bin\Python27\lib\site-packages\zmq\core\socket.pyd
  in zmq.core.socket.Socket.__cinit__ (zmq\core\socket.c:2248)()

ZMQError: Too many open files


For my tests I was manually starting up 8 engines on up to 8 computers
and combining the results of thousands of monte-carlo simulations so I
was giving the parallel code a resonably decent stress test. All the
PCs are Win7 x64 boxes running 32bit Python 2.7.2.

Doing a bit of Googling I found the following:

http://docs.oracle.com/cd/E11035_01/wls100/perform/OSTuning.html#wp1126084
http://www.speedguide.net/articles/windows-7-vista-2008-tweaks-2574

Which seem to suggest the default TCP/IP parameters need to be changed
in the registry.
The attached .reg file will set the registry parameters shown below:

"""
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters]
"EnableWsd"=dword:00000000
"MaxUserPort"=dword:0000fffe
"TcpTimedWaitDelay"=dword:0000001e
"EnableDCA"=dword:00000001
"EnableTCPA"=dword:00000001
"TcpNumConnections"=dword:0000fffe
"""

These changes can be applied manually or by double-clicking the attached file.

I'm not sure that this is the minimal set of changes necessary or even
the correct thing to do, but it has got rid of the ZMQError.

Hopefully this might help other windows users.

Regards,
Dave Hirschfeld
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tcp_parameters.reg
Type: application/octet-stream
Size: 602 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20120110/d5afc753/attachment.obj>


More information about the IPython-dev mailing list