[issue5661] asyncore should catch EPIPE while sending() and receiving()

Xavier de Gaye report at bugs.python.org
Wed Oct 26 21:24:57 CEST 2011


Xavier de Gaye <xdegaye at gmail.com> added the comment:

> I am not marking 'test needed' since the problem is 'hardly reproducible'.

The attached script named 'asyncore_epipe.py' may be used to reproduce
systematically the EPIPE error on linux with Python 3.2:

    * the Reader closes the socket after receiving the first data
    * the Writer gets an exception when attempting to write the next
      message on the closed socket

When you run 'python asyncore_epipe.py' or 'python asyncore_epipe.py
1025' you get an EPIPE error (1025 is the size of exchanged messages,
so the last Writer message has been fully read by the Reader before
closing).

When you run 'python asyncore_epipe.py 128' you get an ECONNRESET (the
Reader reads only 128 bytes before closing the socket)

Note that ECONNRESET has been removed in this script, from the
frozenset of handled errors, to make this last point visible.

So it seems that, on linux, when writing to a closed socket, you get
an ECONNRESET when there is still data in the socket, and an EPIPE
otherwise. In the first case the tcp connection ends with a single
RESET, and in the second case it ends with the sequence FIN-ACK-RESET.

----------
nosy: +xdegaye
Added file: http://bugs.python.org/file23528/asyncore_epipe.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5661>
_______________________________________


More information about the Python-bugs-list mailing list