Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions src/traffic_crashlog/traffic_crashlog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include "tscore/BaseLogFile.h"
#include "tscore/runroot.h"
#include "iocore/eventsystem/RecProcess.h"
#include <poll.h>
#include <unistd.h>

static int syslog_mode = false;
Expand Down Expand Up @@ -172,25 +171,6 @@ main(int /* argc ATS_UNUSED */, const char **argv)
return 0;
}

// In wait mode, we need to verify this is a real crash by checking if crash_logger_invoke
// sent us signal info via the pipe. If traffic_server just exited normally, the pipe will be
// closed with no data, and we should exit without logging a false "crash".
if (wait_mode) {
// Use poll to check if there's data available on stdin without blocking indefinitely.
struct pollfd pfd;
pfd.fd = STDIN_FILENO;
pfd.events = POLLIN;

// Wait briefly for data. If crash_logger_invoke was called, data should already be there.
int poll_result = poll(&pfd, 1, 100); // 100ms timeout

// POLLHUP means the write end of the pipe was closed - normal exit, not crash.
// No data or error also means no crash occurred.
if (poll_result <= 0 || (pfd.revents & POLLHUP) || !(pfd.revents & POLLIN)) {
return 0;
}
}

runroot_handler(argv);
Layout::create();
RecProcessInit(nullptr /* diags */);
Expand Down