From: Alex Rousskov Date: Fri, 1 Mar 2024 22:20:20 +0000 (+0000) Subject: Bug 5069: Keep listening after getsockname() error (#1713) X-Git-Tag: SQUID_6_9~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9be86d8db5e8f40829374d26334d0bb5272c1afd;p=thirdparty%2Fsquid.git Bug 5069: Keep listening after getsockname() error (#1713) 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. --- diff --git a/src/comm/TcpAcceptor.cc b/src/comm/TcpAcceptor.cc index dcc52fbaa1..aa082df4b4 100644 --- a/src/comm/TcpAcceptor.cc +++ b/src/comm/TcpAcceptor.cc @@ -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);