socket wedged forever in recv()

Andrew Bennetts andrew-pythonlist at
Mon Jan 27 03:55:10 CET 2003

On Fri, Jan 24, 2003 at 04:47:19PM -0500, Geoffrey Talvola wrote:
> I have a Windows NT client application that uses httplib to make requests to
> a Windows NT server running Apache 2.0 serving up a cgi script.
> Unfortunately, if I reboot the Apache server, if a request is in-progress,
> the client will often wedge permanently.  I built a debug version of Python
> 2.2.2 and verified that the client is stuck in a call to recv() and will
> apparently never exit.  It's a little irritating that the client can't
> detect the situation and return from recv() with an error code at this
> point.  Does anyone know a way to get the client to notice that the server
> is gone?

I'd recommend using Twisted <> and simply setting a
timeout inside Twisted, which would then close the socket.  Alternatively
you could use select directly -- but Twisted is *much* nicer to work with.
Twisted also has support for SSL.


More information about the Python-list mailing list