On Jul 13, 1:08 pm, Miles <[EMAIL PROTECTED]> wrote: > On Sun, Jul 13, 2008 at 2:32 PM, bukzor <[EMAIL PROTECTED]> wrote: > > On Jul 13, 1:14 am, Miles <[EMAIL PROTECTED]> wrote: > >> On Sat, Jul 12, 2008 at 11:23 PM, bukzor <[EMAIL PROTECTED]> wrote: > >> > 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? > > >> That socket connection is to a remote machine, not the same one. Your > >> test code works fine for me. The "hang then crash" (and I'm assuming > >> "crash" here means an uncaught exception) just means that your packets > >> are being silently ignored by whatever machine you're actually > >> attempting to connect to. It's possible that your machine has odd DNS > >> settings causing buzkor.hopto.org to resolve to the wrong address. > > > I'm connecting to my machine through the internet, and the resolved > > URL of my router is what you're seeing above. If you run the code > > above you'll see what I mean. > > I did run the code, and as I said, it works fine. Your description of > the setup is not consistent. The netstat output unambiguously states > that a Python script on "buzkor" is attempting to open a connection to > the HTTP port on the "adsl" machine (and failing because "adsl" is not > responding). The problem here is not Python; you seem to be confused > about which machine is connecting to which. > > -Miles
The problem only manifests about 1 in 20 runs. Below there's code for a client that shows the problem 100% of the time. The two URL's that I seem to be "confused" about point to the same IP. Maybe this will make it clear: PING bukzor.hopto.org (75.61.84.249) 56(84) bytes of data. 64 bytes from adsl-75-61-84-249.dsl.pltn13.sbcglobal.net (75.61.84.249): icmp_seq=1 ttl=255 time=1.68 ms 64 bytes from adsl-75-61-84-249.dsl.pltn13.sbcglobal.net (75.61.84.249): icmp_seq=2 ttl=255 time=0.493 ms 64 bytes from adsl-75-61-84-249.dsl.pltn13.sbcglobal.net (75.61.84.249): icmp_seq=3 ttl=255 time=0.602 ms Apparently netstat truncated the URL before. Here's the code I mentioned: [code] #!/usr/bin/env python from xmlrpclib import ServerProxy from time import time s = ServerProxy("http://bukzor.hopto.org/modpython/xmlrpc.py", verbose=True) i = 0 start = time() while True: print s.helloworld() print s.add(1,2) print s.subtract(1,2) i += 3 print "AVG: %.2fs" % ((time() - start) / i) [/code] Thanks, --Buck -- http://mail.python.org/mailman/listinfo/python-list