socket wedged forever in recv()
gtalvola at nameconnector.com
Mon Jan 27 18:27:17 CET 2003
Andrew Bennetts [mailto:andrew-pythonlist at puzzling.org] wrote:
> 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 <http://twistedmatrix.com/> and
> simply setting a
> timeout inside Twisted, which would then close the socket.
> you could use select directly -- but Twisted is *much* nicer
> to work with.
> Twisted also has support for SSL.
My understanding is that Twisted would require me to restructure my code to
be event-driven, which would be quite a bit of work. Also, it's a pretty
large package with a lot to learn. If I were starting something new, I'd
consider it, but I don't think it's a good option for my problem which is
affecting a base of existing code.
But, as I stated in another message, I did eventually figure out how to get
timeoutsocket.py to work with SSL sockets so that solves my problem.
More information about the Python-list