[Medusa-dev] EPIPE on asyncore.recv()

David Buscher dfb at mrao.cam.ac.uk
Tue Jun 24 14:46:23 EDT 2003


In fact I *had* misdiagnosed the error: EPIPE is generated when the client
sends a request and closes the connection before the server is able to
send the reply: a slightly hard to reproduce timing-related error and hard
to diagnose if you don't understand all the subtleties of exception
handlers and tracebacks.

I am now trying to fix the channel cleanup problem by writing a new
handle_error() which calls handle_close() and not just close().

David

On Mon, 23 Jun 2003, David Buscher wrote:

> I found that running an asynchat server under Linux, I can get a EPIPE
> socket exception on the server in asyncore.recv() when I have an
> ill-behaved client. Apparently what the client has to do to cause this is
> to close the socket while there is still some data sent by the server that
> it has not read (is this a well-known Linux sockets behaviour?).
>
> This causes problems because, although the exception is caught in
> handle_except(), the handle_close() method is not called and so I cannot
> tidy up the channel object. I am thinking of modifying asyncore.recv()
> to handle EPIPE in the same way as ECONNRESET, ENOTCONN and ESHUTDOWN
> are currently handled.
>
> My only worry is that no-one else has seen this problem and/or made this
> fix before. Am I misdiagnosing an error or handling it in the wrong place?
>
> Any comments welcomed.
>
> thanks
> David
>
> --------------------------------------+----------------------------------
>  Cavendish Laboratory                 |  Phone +44 1223 337302
>  Madingley Road                       |  Fax   +44 1223 354599
>  Cambridge CB3 0HE, UK                |  http://www.mrao.cam.ac.uk/~dfb
> --------------------------------------+----------------------------------
>
>
> _______________________________________________
> Medusa-dev mailing list
> Medusa-dev at python.org
> http://mail.python.org/mailman/listinfo/medusa-dev
>




More information about the Medusa-dev mailing list