]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Ignore ECONNABORTED in accept(2) (#404)
authorMatthieu Herrb <matthieu.herrb@laas.fr>
Mon, 13 May 2019 08:45:57 +0000 (08:45 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Tue, 14 May 2019 14:00:27 +0000 (14:00 +0000)
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

compat/os/mswindows.h
src/comm/TcpAcceptor.cc

index 67dfc8a94c916d8d3d0b13457d9a09b3d6f65db1..e4c35a62b75f45237732b1e920b7c063c04239b3 100644 (file)
@@ -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 */
index 1196ebbb421a668a95c86605d7a75b9db5e3472d..3988eae110d41678f421bacb0d8d3b8b8ad7086b 100644 (file)
@@ -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 {