From: Matthieu Herrb Date: Mon, 13 May 2019 08:45:57 +0000 (+0000) Subject: Ignore ECONNABORTED in accept(2) (#404) X-Git-Tag: SQUID_5_0_1~98 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fb730aadbabc7e3c46343b29b12e5295cb677178;p=thirdparty%2Fsquid.git Ignore ECONNABORTED in accept(2) (#404) An aborted connection attempt does not affect listening socket's ability to accept other connections. If the error is not ignored, Squid gets stuck after logging an oldAccept error like this one: oldAccept ...: (53) Software caused connection abort This bug fix was motivated by accept(2) changes in OpenBSD v6.5 that resulted in new ECONNABORTED errors under regular deployment conditions: https://github.com/openbsd/src/commit/c255b5a --- diff --git a/compat/os/mswindows.h b/compat/os/mswindows.h index 67dfc8a94c..e4c35a62b7 100644 --- a/compat/os/mswindows.h +++ b/compat/os/mswindows.h @@ -358,6 +358,9 @@ typedef char * caddr_t; #ifndef ENOTSUP #define ENOTSUP WSAEOPNOTSUPP #endif +#ifndef ECONNABORTED +#define ECONNABORTED WSAECONNABORTED +#endif #undef h_errno #define h_errno errno /* we'll set it ourselves */ diff --git a/src/comm/TcpAcceptor.cc b/src/comm/TcpAcceptor.cc index 1196ebbb42..3988eae110 100644 --- a/src/comm/TcpAcceptor.cc +++ b/src/comm/TcpAcceptor.cc @@ -361,10 +361,10 @@ Comm::TcpAcceptor::oldAccept(Comm::ConnectionPointer &details) PROF_stop(comm_accept); - if (ignoreErrno(errcode)) { + if (ignoreErrno(errcode) || errcode == ECONNABORTED) { debugs(50, 5, status() << ": " << xstrerr(errcode)); return Comm::NOMESSAGE; - } else if (ENFILE == errno || EMFILE == errno) { + } else if (errcode == ENFILE || errcode == EMFILE) { debugs(50, 3, status() << ": " << xstrerr(errcode)); return Comm::COMM_ERROR; } else {