masaori335 commented on code in PR #13296:
URL: https://github.com/apache/trafficserver/pull/13296#discussion_r3433933116


##########
src/traffic_crashlog/traffic_crashlog.cc:
##########
@@ -213,12 +212,14 @@ main(int /* argc ATS_UNUSED */, const char **argv)
   if (wait_mode) {
     EnableDeathSignal(SIGCONT);
     kill(getpid(), SIGSTOP);
-  }
 
-  // If our parent changed, then we were woken after traffic_server exited. 
There's no point trying to
-  // emit a crashlog because traffic_server is gone.
-  if (getppid() != parent) {
-    return 0;
+    // A real crash sends us a notification on this socket; any other parent 
exit just closes
+    // it, so EOF (or a short read) means there is nothing to log. getppid() 
is unreliable here:
+    // PR_SET_PDEATHSIG can fire while our parent pid is still alive.
+    int crash_signo = 0; // unused; an int keeps the framing aligned with the 
writer
+    if (read(STDIN_FILENO, &crash_signo, sizeof(crash_signo)) != 
sizeof(crash_signo)) {
+      return 0;
+    }

Review Comment:
   Done



-- 
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