-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[runtime] Add a signal handler for sigterm #8240
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
Conversation
|
Fixes #8236 |
|
What's the impact will that have on regular usage of ctrl+c from CLI usage? |
|
I dont think we want to do this for SIGTERM, Rodrigo brings up a good case for why not. |
|
Yes, users expect ctlr+c to just terminate the app without doing anything else. |
25c23ea to
9ad6cf1
Compare
|
Ctrl+c sends a sigint, sigterm is sent by Force Quit and by POSIX |
|
SIGTERM is like SIGKILL, but the dying process is allowed resources to shut down cleanly. This was requested by VS4M for detecting force quit of applications due to hangs. |
|
@monojenkins build pkg |
mono/mini/mini-posix.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be documented in man/mono.1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use g_hasenv
|
How about having another icall to enable this feature (instead of an env var). The MERP stuff is enabled by an icall too, so VSfM won't have to turn knobs in different places. |
mono/mini/mini-posix.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use g_hasenv
|
@lewurm if we want to keep this feature for MERP only, then we will just enable it in the same icall as we enable MERP support, no need to create another one. |
80fc8f2 to
ccec018
Compare
mono/mini/mini-posix.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be TARGET_OSX
mono/mini/mini-posix.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why keeping the exit (1);?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without an exit(1), you won't exit?
I think there's a minor API confusion here. mono_chain_signal only calls another signal handler if it's already been registered. There's no other sigterm handler, so if you put a print between the chain signal and the exit call, it fires.
Before chain signal And
After chain signal, before exit
Both fire.
This corresponds to the expected state in add_signal_handler, when previous_sa.sa_flags & SA_SIGINFO is false, and we have no already-registered signal handler to save.
For this to work the way you want it to, where removing exit doesn't make it not exit, you'd need to explicitly register the handler at the start of every run that makes mono exit when sent sigterm. POSIX just defaults to externally killing a process when there's no signal handler, that doesn't mean that there's automatically an observable signal handler for sigterm.
4fc4407 to
01b3e83
Compare
|
It's broken on Android and Windows |
4560c91 to
9eaaeed
Compare
|
@monojenkins build Windows x64 |
|
@monojenkins build Linux x64 |
|
@monojenkins build Linux AArch64 |
|
@monojenkins backport to 2018-02 |
|
@monojenkins backport to 2018-04 |
|
@luhenry backporting to 2018-02 failed, the patch results in conflicts: Please backport manually! |
|
@luhenry backporting to 2018-04 failed, the patch results in conflicts: Please backport manually! |
* [runtime] Add a signal handler for sigterm * [runtime] Register sigtramp when merp handler enabled * [runtime] Limit sigterm handler symbol definition to OSX Commit migrated from mono/mono@24ef425
Fixes #8236