]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 5069: Keep listening after getsockname() error (#1713)
authorAlex Rousskov <rousskov@measurement-factory.com>
Fri, 1 Mar 2024 22:20:20 +0000 (22:20 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Fri, 1 Mar 2024 22:20:23 +0000 (22:20 +0000)
    ERROR: Stopped accepting connections:
    error: getsockname() failed to locate local-IP on ...

In many cases, these failures are intermittent client-triggered errors
(e.g., client shut down the accepted socket); Squid will successfully
accept other connections and, hence, should keep listening for them.

src/comm/TcpAcceptor.cc

index dcc52fbaa1b45c52d5ce64e4de023ef64f9264d1..aa082df4b4651cef171b6bf6d10daf20b6b2ef5f 100644 (file)
@@ -381,7 +381,10 @@ Comm::TcpAcceptor::acceptInto(Comm::ConnectionPointer &details)
     if (getsockname(sock, gai->ai_addr, &gai->ai_addrlen) != 0) {
         int xerrno = errno;
         Ip::Address::FreeAddr(gai);
-        throw TextException(ToSBuf("getsockname() failed to locate local-IP on ", details, ": ", xstrerr(xerrno)), Here());
+        debugs(50, DBG_IMPORTANT, "ERROR: Closing accepted TCP connection after failing to obtain its local IP address" <<
+               Debug::Extra << "accepted connection: " << details <<
+               Debug::Extra << "getsockname(2) error: " << xstrerr(xerrno));
+        return false;
     }
     details->local = *gai;
     Ip::Address::FreeAddr(gai);