59 lines
2.0 KiB
Diff
59 lines
2.0 KiB
Diff
From 5850cba2957cc894477e735a74aa6c246b499ff4 Mon Sep 17 00:00:00 2001
|
|
From: Yash Tibrewal <yashkt@google.com>
|
|
Date: Mon, 11 Apr 2022 15:49:18 -0700
|
|
Subject: [PATCH] Ignore Connection Aborted errors on accept (#29318)
|
|
|
|
* Ignore Connection Aborted errors on accept
|
|
|
|
* Reviewer comments
|
|
---
|
|
src/core/lib/iomgr/tcp_server_posix.cc | 32 +++++++++++++-------------
|
|
1 file changed, 16 insertions(+), 16 deletions(-)
|
|
|
|
diff --git a/src/core/lib/iomgr/tcp_server_posix.cc b/src/core/lib/iomgr/tcp_server_posix.cc
|
|
index c40ddbf646..f02bb8396a 100644
|
|
--- a/src/core/lib/iomgr/tcp_server_posix.cc
|
|
+++ b/src/core/lib/iomgr/tcp_server_posix.cc
|
|
@@ -204,22 +204,22 @@ static void on_read(void* arg, grpc_error_handle err) {
|
|
strip off the ::ffff:0.0.0.0/96 prefix first. */
|
|
int fd = grpc_accept4(sp->fd, &addr, 1, 1);
|
|
if (fd < 0) {
|
|
- switch (errno) {
|
|
- case EINTR:
|
|
- continue;
|
|
- case EAGAIN:
|
|
- grpc_fd_notify_on_read(sp->emfd, &sp->read_closure);
|
|
- return;
|
|
- default:
|
|
- gpr_mu_lock(&sp->server->mu);
|
|
- if (!sp->server->shutdown_listeners) {
|
|
- gpr_log(GPR_ERROR, "Failed accept4: %s", strerror(errno));
|
|
- } else {
|
|
- /* if we have shutdown listeners, accept4 could fail, and we
|
|
- needn't notify users */
|
|
- }
|
|
- gpr_mu_unlock(&sp->server->mu);
|
|
- goto error;
|
|
+ if (errno == EINTR) {
|
|
+ continue;
|
|
+ } else if (errno == EAGAIN || errno == ECONNABORTED ||
|
|
+ errno == EWOULDBLOCK) {
|
|
+ grpc_fd_notify_on_read(sp->emfd, &sp->read_closure);
|
|
+ return;
|
|
+ } else {
|
|
+ gpr_mu_lock(&sp->server->mu);
|
|
+ if (!sp->server->shutdown_listeners) {
|
|
+ gpr_log(GPR_ERROR, "Failed accept4: %s", strerror(errno));
|
|
+ } else {
|
|
+ /* if we have shutdown listeners, accept4 could fail, and we
|
|
+ needn't notify users */
|
|
+ }
|
|
+ gpr_mu_unlock(&sp->server->mu);
|
|
+ goto error;
|
|
}
|
|
}
|
|
|
|
--
|
|
2.33.0
|
|
|