bryancall opened a new pull request, #13541:
URL: https://github.com/apache/trafficserver/pull/13541

   `Log::init()` sets `Log::preproc_threads` to 1 immediately, but 
`Log::preproc_notify` is not allocated until `Log::create_threads()`. A 
shutdown signal arriving between those two points is picked up by the already 
running `SignalContinuation`, which schedules `AutoStopCont`. Its `mainEvent` 
then walks `preproc_threads` entries of a null array:
   
   ```c++
   // Wake preproc threads to drain remaining log buffers before exit.
   for (int i = 0; i < Log::preproc_threads; i++) {
     Log::preproc_notify[i].signal();
   }
   ```
   
   The result is a SIGSEGV at address zero on a process that was killed during 
startup.
   
   #13472 added exactly this guard to the two call sites in `LogObject.cc` and 
described the same failure, but it did not cover this third copy in 
`traffic_server.cc`, which was introduced separately by #13065. Production 
crash reports show this site still firing on builds that already carry the 
`LogObject.cc` guards, which is what pointed at the gap.
   
   This change wraps the loop in the same `nullptr` test those two call sites 
use.
   
   ### Scope
   
   The fourth use, in `PeriodicWakeup::wakeup`, is not affected and is left 
alone: it is only scheduled on the line immediately after `create_threads()` 
returns, so the array is always allocated by then.
   
   ### Impact
   
   Startup window only. `start_HttpProxyServer()` runs well after 
`Log::load_config()`, so a process that reaches this path never served traffic. 
The cost is a crash and a core file where a clean exit belonged, not a traffic 
impact.
   
   ### Testing
   
   Not yet built locally. Opened as a draft to let CI compile and run it first.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to