[server] Keep server running after failed UDS getpeername

pull/35823/head
AJ Heller 10 months ago
parent 6cd53e1c80
commit 2b38aa55bc
  1. 13
      src/core/lib/event_engine/posix_engine/posix_engine_listener.cc
  2. 6
      src/core/lib/iomgr/tcp_server_posix.cc

@ -45,6 +45,7 @@
#include "src/core/lib/event_engine/posix_engine/tcp_socket_utils.h"
#include "src/core/lib/event_engine/tcp_socket_utils.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/gprpp/strerror.h"
#include "src/core/lib/gprpp/time.h"
#include "src/core/lib/iomgr/socket_mutator.h"
@ -173,7 +174,7 @@ void PosixEngineListenerImpl::AsyncConnectionAcceptor::NotifyOnAccept(
return;
default:
gpr_log(GPR_ERROR, "Closing acceptor. Failed accept4: %s",
strerror(errno));
grpc_core::StrError(errno).c_str());
// Shutting down the acceptor. Unref the ref grabbed in
// AsyncConnectionAcceptor::Start().
Unref();
@ -189,15 +190,13 @@ void PosixEngineListenerImpl::AsyncConnectionAcceptor::NotifyOnAccept(
auto listener_addr_uri = ResolvedAddressToURI(socket_.addr);
gpr_log(
GPR_ERROR,
"Failed getpeername: %s. This is a critical failure, the "
"listener on %s:%d is shutting down.",
strerror(errno),
"Failed getpeername: %s. Dropping the connection, and continuing "
"to listen on %s:%d.",
grpc_core::StrError(errno).c_str(),
listener_addr_uri.ok() ? listener_addr_uri->c_str() : "<unknown>",
socket_.port);
close(fd);
// Shutting down the acceptor. Unref the ref grabbed in
// AsyncConnectionAcceptor::Start().
Unref();
handle_->NotifyOnRead(notify_on_accept_);
return;
}
addr = EventEngine::ResolvedAddress(addr.address(), len);

@ -429,13 +429,13 @@ static void on_read(void* arg, grpc_error_handle err) {
auto listener_addr_uri = grpc_sockaddr_to_uri(&sp->addr);
gpr_log(
GPR_ERROR,
"Failed getpeername: %s. This is a critical failure, the "
"listener on %s:%d is shutting down.",
"Failed getpeername: %s. Dropping the connection, and continuing "
"to listen on %s:%d.",
grpc_core::StrError(errno).c_str(),
listener_addr_uri.ok() ? listener_addr_uri->c_str() : "<unknown>",
sp->port);
close(fd);
goto error;
continue;
}
}

Loading…
Cancel
Save