Skip to content

Fix SIGABRT not causing a core dump#10416

Merged
jschmidt-icinga merged 2 commits intomasterfrom
jschmidt/sigabrt-handler-fix
Apr 23, 2025
Merged

Fix SIGABRT not causing a core dump#10416
jschmidt-icinga merged 2 commits intomasterfrom
jschmidt/sigabrt-handler-fix

Conversation

@jschmidt-icinga
Copy link
Copy Markdown
Contributor

A second abort() is needed at the end of SigAbrtHandler() to trigger the SIG_DFL action (in this case the core dump).

Also since AttachDebugger() disables the ability to dump core, so it gets reenabled after returning from it.

I've tested and verified that the backtraces generated with gdb in AttachDebugger() still appear in the crash-log file.

This fixes #8908.
I will address the documentation changes for #8714 in a second PR.

A second abort() is needed at the end of `SigAbrtHandler()` to trigger the SIG_DFL action (in this case the core dump).

Also since `AttachDebugger()` disables the ability to dump core, so
it gets reenabled after returning from it.
Copy link
Copy Markdown
Member

@julianbrost julianbrost left a comment

Choose a reason for hiding this comment

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

A second abort() is needed at the end of SigAbrtHandler() to trigger the SIG_DFL action (in this case the core dump).

That's actually only necessary when triggering this by only sending SIGABRT (for example using kill -ABRT $icinga2_pid externally). Calling abort() within the Icinga 2 process actually does something similar by itself already (man 3 abort:

If the SIGABRT signal is ignored, or caught by a handler that returns, the abort() function will still terminate the process. It does this by restoring the default disposition for SIGABRT and then raising the signal for a second time.

Adding the second abort() that actually fixes a strange problem I observed during testing: Before, when sending SIGABRT externally, it would log that "critical/Application: Icinga 2 has terminated unexpectedly. Additional information can be found in [...]" message but actually continue running (sending SIGABRT a second time then terminated it using the default handler).

@jschmidt-icinga jschmidt-icinga merged commit 235a3e1 into master Apr 23, 2025
26 checks passed
@jschmidt-icinga jschmidt-icinga deleted the jschmidt/sigabrt-handler-fix branch April 23, 2025 14:08
@oxzi oxzi added this to the 2.15.0 milestone Apr 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SIGABRT should write a core dump

4 participants