threads and memory

Fredrik Lundh fredrik at pythonware.com
Mon Feb 6 15:13:55 EST 2006


Lee Leahu wrote:
> > Yes. You don't need one thread per connection:
> > http://docs.python.org/lib/module-asyncore.html
>
> I am running into a problem where asyncore is through a filedescriptor
> error if I try to launch more that 1023 connections:
> ------------------------------------
> Traceback (most recent call last):
>   File "./test.py", line 46, in ?
>     asyncore.loop()
>   File "/usr/lib/python2.4/asyncore.py", line 192, in loop
>     poll_fun(timeout, map)
>   File "/usr/lib/python2.4/asyncore.py", line 122, in poll
>     r, w, e = select.select(r, w, e, timeout)
> ValueError: filedescriptor out of range in select()
> ------------------------------------
>
> Is there a limitation on the number of simultaneous connects that can
> be made with asyncore ?

what does "ulimit -n" (max number of file descriptors) say on your machine?

if it says 1024, that's what you're seeing.  to increase this, you
have to reconfigure your OS.

if you get a larger value, you can try passing use_poll=True to the
asyncore.loop function.

if use_poll doesn't work, you may have to rebuild Python's select
module to support more handles.  see the comments at the top of
Modules/selectmodule.c for details.

</F>






More information about the Python-list mailing list