Select hangs after some reads
alsmeirelles at gmail.com
alsmeirelles at gmail.com
Wed Jun 7 23:27:14 EDT 2006
Hi,
I'm building a multithreaded application and I encountered a tiny and
annoying problem. I use a select to wait for data to be read from a
socket, after some reads, the select simply blocks and stays that way
until I close the connection on the other side of the socket. When the
socket is closed on the writer end the select releases and then I get
only empty strings from the socket.
My question is this: Why did it block? The reading has never ended,
every test I make I write 50 requests (wich are strings) to the socket
and I have read the maximum of 34 requests. I'm using winPdb to take a
closer look on what's happening and I see the threads blocked on this
same select. If I send anything more through the socket, the select
releases for a thread, despite the other data that is still unread.
This is the select:
rd,w,e = select.select([self.rfd],[],[])
self.rfd is the fileno of the file object returned by the makefile
method from the socket object.
I know that's some buffer behavior that I'm missing but I don't know
what it is.
anything is helpfull, If I'm beeing stupid you can say it.
thanks
More information about the Python-list
mailing list