socket.connect() hangs in SYN_SENT state.

bukzor workitharder at gmail.com
Sun Jul 13 05:23:16 CEST 2008


I'm having an issue where my program hangs while doing
socket.connect() for a couple minutes, then times out the connection
and crashes. I'm connecting to an apache2 process on the same machine,
for testing. When looking at netstat, the socket is in the SYN_SENT
state, like this:

$netstat -a -tcp
tcp        0      0 *:www                   *:*
LISTEN      7635/apache2
tcp        0      1 bukzor:38234            adsl-75-61-84-249.d:www
SYN_SENT    9139/python

Anyone know a general reason this might happen? Even better, a way to
fix it?


Doing a minimal amount of research, I found this in the netstat
manual:
The state SYN_SENT means that an application has made arequest for a
TCP session, but has not yet received the return SYN+ACK packet.

This would indicate it's a server issue, but it seems very stable when
I look at it via a browser.


Here's the server. If you browse to it, it documents the exported
functions:
http://bukzor.hopto.org/modpython/xmlrpc.py

Here's my test client that's hanging. Turn 'verbose' to True to get
more debugging info.

[code]
#!/usr/bin/env python
from xmlrpclib import ServerProxy

s = ServerProxy("http://bukzor.hopto.org/modpython/xmlrpc.py",
verbose=False)

print s.helloworld()
print s.add(1,2)
print s.subtract(1,2)
[/code]


Thanks,
--Buck



More information about the Python-list mailing list