diff --git a/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc b/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc index 07a4c99f966..09dc4d5929c 100644 --- a/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +++ b/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc @@ -186,8 +186,14 @@ void PosixEngineListenerImpl::AsyncConnectionAcceptor::NotifyOnAccept( if (addr.address()->sa_family == AF_UNIX) { socklen_t len = EventEngine::ResolvedAddress::MAX_SIZE_BYTES; if (getpeername(fd, const_cast(addr.address()), &len) < 0) { - gpr_log(GPR_ERROR, "Closing acceptor. Failed getpeername: %s", - strerror(errno)); + 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), + listener_addr_uri.ok() ? listener_addr_uri->c_str() : "", + socket_.port); close(fd); // Shutting down the acceptor. Unref the ref grabbed in // AsyncConnectionAcceptor::Start(). diff --git a/src/core/lib/iomgr/tcp_server_posix.cc b/src/core/lib/iomgr/tcp_server_posix.cc index c4d371a3d1c..faf579ff123 100644 --- a/src/core/lib/iomgr/tcp_server_posix.cc +++ b/src/core/lib/iomgr/tcp_server_posix.cc @@ -420,8 +420,14 @@ static void on_read(void* arg, grpc_error_handle err) { addr.len = static_cast(sizeof(struct sockaddr_storage)); if (getpeername(fd, reinterpret_cast(addr.addr), &(addr.len)) < 0) { - gpr_log(GPR_ERROR, "Failed getpeername: %s", - grpc_core::StrError(errno).c_str()); + 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.", + grpc_core::StrError(errno).c_str(), + listener_addr_uri.ok() ? listener_addr_uri->c_str() : "", + sp->port); close(fd); goto error; }