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 2026/08/24 15:39:49 UTC

(trafficserver) branch master updated: Guard the shutdown log wakeup against an unallocated notify array (#13541)

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

bryancall 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 1fab002d6c Guard the shutdown log wakeup against an unallocated notify array (#13541)
1fab002d6c is described below

commit 1fab002d6c675b5565e51c87e39e489d2005763f
Author: Bryan Call <bc...@apache.org>
AuthorDate: Mon Aug 24 08:39:43 2026 -0700

    Guard the shutdown log wakeup against an unallocated notify array (#13541)
    
    Log::init() sets Log::preproc_threads to a nonzero value, but
    Log::preproc_notify is not allocated until Log::create_threads(), which runs
    much later in startup and not at all in command mode. AutoStopCont::mainEvent
    walked the array anyway, so a shutdown arriving in that window dereferences
    null, and production cores fault in that loop. A null array means no preproc
    thread exists and nothing to drain, so skip the wakeup.
---
 src/traffic_server/traffic_server.cc | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/traffic_server/traffic_server.cc b/src/traffic_server/traffic_server.cc
index 1f174fb181..91296a95b3 100644
--- a/src/traffic_server/traffic_server.cc
+++ b/src/traffic_server/traffic_server.cc
@@ -309,9 +309,13 @@ struct AutoStopCont : public Continuation {
       CacheShm::mark_clean_shutdown();
     }
 
-    // Wake preproc threads to drain remaining log buffers before exit.
-    for (int i = 0; i < Log::preproc_threads; i++) {
-      Log::preproc_notify[i].signal();
+    // Wake preproc threads to drain remaining log buffers before exit. The notify array is allocated only when the log
+    // threads are spawned, which happens well after Log::init() during startup and not at all in command mode, so a
+    // null array means there is no preproc thread in existence and nothing to wake.
+    if (Log::preproc_notify != nullptr) {
+      for (int i = 0; i < Log::preproc_threads; i++) {
+        Log::preproc_notify[i].signal();
+      }
     }
     delete this;
     return EVENT_CONT;