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 ff31470a8c Fix flaky autests for timeout, sigusr2, and thread_config 
(#13012)
ff31470a8c is described below

commit ff31470a8c46ef6eb45e32d8cb75f6a1ed1a8d61
Author: Bryan Call <[email protected]>
AuthorDate: Wed Mar 25 13:25:44 2026 -0700

    Fix flaky autests for timeout, sigusr2, and thread_config (#13012)
    
    * Handle SIGPIPE in ssl-delay-server to prevent helper death
      when a client disconnects during TLS handshake delay.
    * Retry accept() on EINTR under heavy parallel load instead
      of treating the interruption as a fatal error.
    * Fix accept() error check to use < 0 instead of <= 0 since
      fd 0 is a valid descriptor when stdin is closed.
    * Add cmdline matching fallback in check_threads.py for ASAN
      where the process CWD differs from expected ts_path.
---
 tests/gold_tests/thread_config/check_threads.py | 11 +++++++----
 tests/gold_tests/timeout/ssl-delay-server.cc    | 13 ++++++++++---
 2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/tests/gold_tests/thread_config/check_threads.py 
b/tests/gold_tests/thread_config/check_threads.py
index 1a7de52cb9..e0347b7ddd 100755
--- a/tests/gold_tests/thread_config/check_threads.py
+++ b/tests/gold_tests/thread_config/check_threads.py
@@ -36,13 +36,16 @@ def _count_threads_once(ts_path, etnet_threads, 
accept_threads, task_threads, ai
             # Find the pid corresponding to the ats process we started in 
autest.
             # It needs to match the process name and the binary path.
             # If autest can expose the pid of the process this is not needed 
anymore.
+            # Match by CWD or command line containing ts_path, since under
+            # ASAN the CWD may differ from the expected path.
             process_name = p.name()
             process_cwd = p.cwd()
             process_exe = p.exe()
-            if process_cwd != ts_path:
-                continue
-            if process_name != '[TS_MAIN]' and process_name != 
'traffic_server' and os.path.basename(
-                    process_exe) != 'traffic_server':
+            is_ts = process_name == '[TS_MAIN]' or process_name == 
'traffic_server' or os.path.basename(
+                process_exe) == 'traffic_server'
+            match_by_cwd = process_cwd == ts_path
+            match_by_cmdline = any(ts_path in arg for arg in (p.cmdline() or 
[]))
+            if not is_ts or not (match_by_cwd or match_by_cmdline):
                 continue
         except (psutil.NoSuchProcess, psutil.AccessDenied, 
psutil.ZombieProcess):
             continue
diff --git a/tests/gold_tests/timeout/ssl-delay-server.cc 
b/tests/gold_tests/timeout/ssl-delay-server.cc
index d993696229..3f509f0e36 100644
--- a/tests/gold_tests/timeout/ssl-delay-server.cc
+++ b/tests/gold_tests/timeout/ssl-delay-server.cc
@@ -39,6 +39,7 @@
 #include <sys/time.h>
 #include <sys/select.h>
 #include <cerrno>
+#include <csignal>
 
 char req_buf[10000];
 char post_buf[1000];
@@ -156,6 +157,10 @@ main(int argc, char *argv[])
   ttfb_delay           = atoi(argv[3]);
   const char *pem_file = argv[4];
 
+  // Ignore SIGPIPE which can be raised when a client disconnects during
+  // the handshake delay, killing the process unexpectedly.
+  signal(SIGPIPE, SIG_IGN);
+
   fprintf(stderr, "Listen on %d connect delay=%d ttfb delay=%d\n", 
listen_port, connect_delay, ttfb_delay);
 
   int                listenfd = socket(AF_INET, SOCK_STREAM, 0);
@@ -198,9 +203,11 @@ main(int argc, char *argv[])
 
   for (;;) {
     sfd = accept(listenfd, (struct sockaddr *)nullptr, nullptr);
-    if (sfd <= 0) {
-      // Failure
-      printf("Listen failure\n");
+    if (sfd < 0) {
+      if (errno == EINTR) {
+        continue;
+      }
+      printf("Listen failure errno=%d\n", errno);
       exit(1);
     }
 

Reply via email to