[Tutor] weird socket errors on linux with asyncore
Kent Johnson
kent37 at tds.net
Mon Aug 13 14:30:27 CEST 2007
Lawrence Wang wrote:
> apologies if this doesn't belong on tutor.
>
> i have a long-running script that manages a bunch of sockets with
> asyncore, opening 600 connections every 30 seconds for short
> transactions, and every now and then (like anywhere from twice an hour
> to once every few hours) i get this weird error: "filedescriptor out of
> range in select()". i found a bug report that stated that this was an
> issue with python 2.4.3, so i upgraded to 2.5.1 -- but it's still
> happening. anyone seen this before?
I'm guessing here...Googling finds these threads:
http://mail.python.org/pipermail/python-list/2003-June/211842.html
http://groups.google.co.kr/group/comp.lang.python/msg/12b55d8a2fe61a20
both of which suggest that the problem is too many open files and the
solution is to use poll() instead of select().
What platform are you running on? Can you figure out the max number of
sockets configured in your implementation of Python (the value of
FD_SETSIZE in socketmodule.c)?
Perhaps you are occasionally trying to open too many sockets. Either 600
is too many and usually you close some sockets before all 600 have been
opened, or maybe sometimes enough of the 600 have not completed in 30
seconds that the next poll overflows?
HTH
Kent
More information about the Tutor
mailing list