You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2021/10/27 16:53:38 UTC

[trafficserver] branch master updated: Ignore ECONNABORTED on blocking accept (#8453)

This is an automated email from the ASF dual-hosted git repository.

bcall pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 268b540  Ignore ECONNABORTED on blocking accept (#8453)
268b540 is described below

commit 268b540edae0b3e51d033795a4dd7404a5756a93
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Thu Oct 28 01:53:14 2021 +0900

    Ignore ECONNABORTED on blocking accept (#8453)
---
 iocore/net/P_UnixNet.h      |  4 +++-
 iocore/net/UnixNetAccept.cc | 30 ++++++++++++++++++++----------
 2 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/iocore/net/P_UnixNet.h b/iocore/net/P_UnixNet.h
index 0043e1d..cff9439 100644
--- a/iocore/net/P_UnixNet.h
+++ b/iocore/net/P_UnixNet.h
@@ -480,6 +480,7 @@ change_net_connections_throttle(const char *token, RecDataT data_type, RecData v
   return 0;
 }
 
+// 2  - ignore
 // 1  - transient
 // 0  - report as warning
 // -1 - fatal
@@ -487,8 +488,9 @@ TS_INLINE int
 accept_error_seriousness(int res)
 {
   switch (res) {
-  case -EAGAIN:
   case -ECONNABORTED:
+    return 2;
+  case -EAGAIN:
   case -ECONNRESET: // for Linux
   case -EPIPE:      // also for Linux
     return 1;
diff --git a/iocore/net/UnixNetAccept.cc b/iocore/net/UnixNetAccept.cc
index d1ecc22..1ce5923 100644
--- a/iocore/net/UnixNetAccept.cc
+++ b/iocore/net/UnixNetAccept.cc
@@ -295,19 +295,29 @@ NetAccept::do_blocking_accept(EThread *t)
   do {
     if ((res = server.accept(&con)) < 0) {
       int seriousness = accept_error_seriousness(res);
-      if (seriousness >= 0) { // not so bad
-        if (!seriousness) {   // bad enough to warn about
-          check_transient_accept_error(res);
-        }
+      switch (seriousness) {
+      case 0:
+        // bad enough to warn about
+        check_transient_accept_error(res);
         safe_delay(net_throttle_delay);
         return 0;
+      case 1:
+        // not so bad but needs delay
+        safe_delay(net_throttle_delay);
+        return 0;
+      case 2:
+        // ignore
+        return 0;
+      case -1:
+        [[fallthrough]];
+      default:
+        if (!action_->cancelled) {
+          SCOPED_MUTEX_LOCK(lock, action_->mutex ? action_->mutex : t->mutex, t);
+          action_->continuation->handleEvent(EVENT_ERROR, (void *)static_cast<intptr_t>(res));
+          Warning("accept thread received fatal error: errno = %d", errno);
+        }
+        return -1;
       }
-      if (!action_->cancelled) {
-        SCOPED_MUTEX_LOCK(lock, action_->mutex ? action_->mutex : t->mutex, t);
-        action_->continuation->handleEvent(EVENT_ERROR, (void *)static_cast<intptr_t>(res));
-        Warning("accept thread received fatal error: errno = %d", errno);
-      }
-      return -1;
     }
     // check for throttle
     if (!opt.backdoor && check_net_throttle(ACCEPT)) {