gmoccapy: exit on SIGTERM/SIGINT regardless of main-loop state#4115
Merged
Conversation
The KeyboardInterrupt-via-excepthook path only quits while Gtk.main() is iterating; a signal during startup or a nested dialog hits 'gtk_main_quit: assertion main_loops != NULL' and gmoccapy runs on until SIGKILL. Install an explicit handler that quits the loop if one runs, else exits the process.
Contributor
Author
|
@andypugh need merge this too, then the smoke test phase 2 should pass, I think 🤔 |
Contributor
Author
|
@BsAtHome when you have a moment, could you take a look at this one? It is the gmoccapy half of the SIGTERM cleanup; #4076 only quits while the Gtk main loop is iterating, so a signal during startup or a nested dialog hits |
grandixximo
added a commit
to grandixximo/linuxcnc
that referenced
this pull request
Jun 4, 2026
LinuxCNC#4115 installs the signal handler just before Gtk.main(), so a SIGTERM arriving during construction is still handled by the excepthook via KeyboardInterrupt. With no main loop running, Gtk.main_quit() asserts and the interrupt is swallowed at the GTK C boundary, so the process runs on until SIGKILL. Force the exit when no loop is active.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
gmoccapy did not reliably exit on SIGTERM; callers had to escalate to SIGKILL.
#4076 routed the signal through
excepthooktoGtk.main_quit(), but that only quits whileGtk.main()is iterating. A signal arriving during startup, or while a nested dialog is up, hitsgtk_main_quit: assertion 'main_loops != NULL'and gmoccapy keeps running.This installs an explicit SIGTERM/SIGINT handler that quits the loop if one is active, otherwise exits the process. Surfaced by the ui-smoke quit-path tests (#4054).