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:47 UTC

[trafficserver] branch 8.1.x updated: Ignore ECONNABORTED on blocking accept (#8456)

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

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


The following commit(s) were added to refs/heads/8.1.x by this push:
     new 2b07874  Ignore ECONNABORTED on blocking accept (#8456)
2b07874 is described below

commit 2b078741ecf14cbc7f5773b3e14ef0c1d3cf4cfb
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Thu Oct 28 01:53:25 2021 +0900

    Ignore ECONNABORTED on blocking accept (#8456)
    
    (cherry picked from commit 5b727f177fa7d1bea4b0571551dbb8f680b4ef62)
    
    Conflicts:
    	iocore/net/UnixNetAccept.cc
---
 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 0440b72..8e4d18b 100644
--- a/iocore/net/P_UnixNet.h
+++ b/iocore/net/P_UnixNet.h
@@ -447,6 +447,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
@@ -454,8 +455,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 5d5288d..c9915c5 100644
--- a/iocore/net/UnixNetAccept.cc
+++ b/iocore/net/UnixNetAccept.cc
@@ -261,19 +261,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, t);
-        action_->continuation->handleEvent(EVENT_ERROR, (void *)(intptr_t)res);
-        Warning("accept thread received fatal error: errno = %d", errno);
-      }
-      return -1;
     }
     // check for throttle
     if (!opt.backdoor && check_net_throttle(ACCEPT)) {