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

Discussing ExitReason::Aborted #15268

Open
straight-shoota opened this issue Dec 11, 2024 · 0 comments
Open

Discussing ExitReason::Aborted #15268

straight-shoota opened this issue Dec 11, 2024 · 0 comments

Comments

@straight-shoota
Copy link
Member

straight-shoota commented Dec 11, 2024

I'm wondering about the definition of ExitReason::Aborted: It's mapped to Signal::ABRT, Signal::KILL, Signal::QUIT, and the NTSTATUS valueSTATUS_FATAL_APP_EXIT.

ExitReason was introduced in #13052 with prior discussion in #12284, but the individual associations were not discussed in detail.

The name indicates a relation to the C function abort()1 and thus Signal::ABRT and its Windows equivalent LibC::STATUS_FATAL_APP_EXIT. So that's fine.

Signal::KILL

My most concern is with Signal::KILL. It is the absolute tool to make a process terminate and it cannot be caught or ignored. That's a distinctive difference to all other signals and can be relevant for user communication. For example the compiler uses different wording to describe the exit reason of a killed process:

if signal.kill?
"Program was killed"
else
"Program received and didn't handle signal #{signal} (#{signal.value})"
end

The program could never handle SIGKILL, so this special-casing makes sure to avoid suggesting that it could do that.
So I think it would be useful if ExitReason could express a difference between SIGKILL and SIGABRT without having to parse signal values explicitly in user code.

Signal::QUIT

I suppose the relation to Signal::QUIT is that it can be considered as the external equivalent of abort().
Although it's also related to Signal::TERM (which maps to ExitReason::SessionEnded) because their default behaviour is identical except that Signal::QUIT usually also implies a core dump. And an application could make a difference between handling them: TERM asks very nicely for graceful termination, while QUIT may involve skipping some cleanup tasks in order to provide debugging information.

Footnotes

  1. Though not Crystal's ::abort method. It causes a normal exit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant