select() call and filedescriptor out of range in select error

k3xji sumerc at
Thu Sep 16 06:05:49 CEST 2010

Hi all,

We have a select-based server written in Python. Occasionally, maybe
twice a month there occurs a weird problem, select() returns with
filedescriptor out of range in select() error. This is of course a
normal error and handled gracefully. Our policy is to take down few
users for select() to handle the next cycle. However, once this error
occurs, this also fails too:


self.__Socket's is the very basic list of sockets we use in our IO
loop. The call fails with:
remove(x): x not in list

First of all, in our entire application there is no line of code like
remove(x), meaning there is no x variable. Second, the Exception shows
the line number containing above code. So
self.__Sockets.remove(socket) this fails with remove(x): x not in

I cannot understand the problem. It happens in sporadic manner and it
feels that the ValueError of select() call somehow corrupts the List
structure itself in Python? Not sure if something like that is

Thanks in advance,

More information about the Python-list mailing list