[issue30319] ConnectionResetError: [Errno 54] Connection reset by peer in socket.close on FreeBSD, Py 3.6
Martin Panter
report at bugs.python.org
Fri Jun 30 21:18:42 EDT 2017
Martin Panter added the comment:
I think fixing all affected calls to socket.close in the world (option 3) would be too much. I just added two new reports (Issue 30652 and Issue 30391) as dependencies. These are about testing socketserver.TCPServer. As an example, to fix the socket.close call there, I think the change would look like
class TCPServer:
def close_request(self, request):
try:
request.close()
except ConnectionError:
# Suppress asynchronous errors such as ECONNRESET on Free BSD
pass
Instead of that change all over the place, I am thinking option 2 would be safest. In Modules/socketmodule.c, something like
sock_close(PySocketSockObject *s)
{
Py_BEGIN_ALLOW_THREADS
res = SOCKETCLOSE(fd);
Py_END_ALLOW_THREADS
/* ECONNRESET can occur on Free BSD */
if (res < 0 && errno != ECONNRESET) {
return s->errorhandler();
}
}
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30319>
_______________________________________
More information about the Python-bugs-list
mailing list