Threaded socket hang in 1.3.20
Thu Feb 20 17:47:00 GMT 2003
On Thu, Feb 20, 2003 at 03:15:39PM +0100, Corinna Vinschen wrote:
> I looked into this problem
Thanks for your help -- it is much appreciated.
> and it turns out to be a non-socket specific problem but instead a
> deadlock problem in cygheap:
> cygheap_fdnew (int seed_fd = -1, bool lockit = true)
> if (lockit)
> SetResourceLock (LOCK_FD_LIST, WRITE_LOCK | READ_LOCK, "cygheap_fdnew");
I came to the above conclusion yesterday, but did not have a chance to
report back to the list.
> I've cleaned that up a bit and commited the changes.
Thanks! The two Python regression tests no longer hang with the latest
> Now back to the test case. With these changes the socket() call doesn't
> hang but now connect() is in trouble. It hangs for a while until it
> returns with error 116, Connection timeout.
I just tried the test case again and it still fails with 111. FWIW, I
happened to notice that the test case fails with 116 on 1.3.17 (on my
YA FWIW, see attached. I know that you do read Python, but this code
shows that connect() works with threads in at least one situation.
Maybe there is a bug in my test case? Note that I'm only lightly versed
in sockets -- just enough to be dangerous.
> I must admit, that I didn't find the cause so far. Help in debugging
> this is appreciated.
I will try to poke around some more.
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D 8784 1AFD E4CC ECF4 8EF6
-------------- next part --------------
# test asynchat -- requires threading
import thread # If this fails, we can't test this module
import asyncore, asynchat, socket, threading, time
HOST = "127.0.0.1"
PORT = 54321
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
conn, client = sock.accept()
buffer = ""
while "\n" not in buffer:
data = conn.recv(10)
if not data:
buffer = buffer + data
n = conn.send(buffer)
buffer = buffer[n:]
self.buffer = ""
def collect_incoming_data(self, data):
self.buffer = self.buffer + data
print "Received:", `self.buffer`
self.buffer = ""
s = echo_server()
time.sleep(1) # Give server time to initialize
c = echo_client()
More information about the Cygwin-developers