Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signal Handling: Set up a signal handler for common catastrophic failure signals #165

Merged
merged 2 commits into from
Jan 16, 2024

Conversation

CharityKathure
Copy link
Contributor

@CharityKathure CharityKathure commented Dec 6, 2023

Testing (simulating catastrophic failure):

image

image

@CharityKathure CharityKathure linked an issue Dec 6, 2023 that may be closed by this pull request
Comment on lines +276 to +279
setSignalHandler(SIGSEGV, signalHandler); // Segmentation fault
setSignalHandler(SIGFPE, signalHandler); // Floating point exception
setSignalHandler(SIGILL, signalHandler); // Illegal instruction
setSignalHandler(SIGABRT, signalHandler); // Abort
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. There are more signals like SIGBUS and SIGPIPE etc that might cause catastrophic failures do you reckon we should include them? Also you can think if we can capture more info when we have such failures. At the moment we are only logging the signal type. It is possbile to log info like timestamp, stack trace when we have these signals?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the TraceError function to log the catastrophic failure ensures that timestamp is captured:

https://github.com/microsoft/windows-container-tools/blob/04885c694bb89ca78437f8dcfe19389f3211102b/LogMonitor/src/LogMonitor/LogWriter.h#L93C13-L93C53

image

@CharityKathure CharityKathure merged commit aa6ea06 into main Jan 16, 2024
8 checks passed
@CharityKathure CharityKathure deleted the signal-handler branch May 8, 2024 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] ][LOGMONITOR] ERROR: Failed to query next event. Error: 21.
3 participants