GNOME Bugzilla – Bug 607658
Should emit "EndSession" when receiving SIGTERM
Last modified: 2010-03-08 23:36:36 UTC
As title, this is very useful for those child processes do the cleanup thing. This bug is come from http://defect.opensolaris.org/bz/show_bug.cgi?id=13982. at-spi-registryd need clear the IOR when it gets "EndSession" signal from gnome-session. When gnome-session was killed by receiving SIGTERM, it does not send out the "EndSession" signal.
Created attachment 151943 [details] [review] patch for bug #607658 I'm hacking the code to emit "EndSession" when receiving SIGTERM, it works so far but kind of ugly. The gnome-session experts might have a nicer fix.
Comment on attachment 151943 [details] [review] patch for bug #607658 Note that you should handle SIGINT and SIGTERM the same way, I guess. Also, instead of adding some new API to gsm-manager.c, please use gsm_manager_logout (manager, GSM_MANAGER_LOGOUT_MODE_FORCE, NULL). And make sure we return TRUE to signal_cb(), so that we can do the exit process normally.
(In reply to comment #2) > (From update of attachment 151943 [details] [review]) > Note that you should handle SIGINT and SIGTERM the same way, I guess. > > Also, instead of adding some new API to gsm-manager.c, please use > gsm_manager_logout (manager, GSM_MANAGER_LOGOUT_MODE_FORCE, NULL). And make > sure we return TRUE to signal_cb(), so that we can do the exit process > normally. I rework the patch as your suggest, With GDM, the wait programs dialog pops up after login a user, the greeter session won't quit. Any way to block this dialog appear?
Ah, hrm, interesting :-) I'm not quite sure why this would happen, especially with MODE_FORCE. Sounds like a bug to me. You can patch gsm_manager_is_logout_inhibited() to look at the forceful_logout variable too.
(In reply to comment #4) > Ah, hrm, interesting :-) I'm not quite sure why this would happen, especially > with MODE_FORCE. Sounds like a bug to me. You can patch > gsm_manager_is_logout_inhibited() to look at the forceful_logout variable too. I debug into this function, manager->priv->forceful_logout is TRUE. Run a "dbus-monitor --session>/tmp/dbus.out 2>&1" before login, it shows me the "EndSession" signal is not emitted. However, there are four "ClientRemoved" and "InhibitorAdded" are emitted. Vincent, any idea?
When gnome-session receive SIGTERM, all its children get SIGTERM too and exit. This cause gnome-session does not go to phase END_SESSION and EXIT. That's why "EndSession" signal is not send. I'm thinking gnome-session should block SIGTERM passed to its children. This means gnome-session will quit as usual when receiving SIGTERM. Here "usual" means same as receiving "Logout" D-Bus call. Does it make sense?
Created attachment 151989 [details] [review] safely quit when receiving SIGTERM and SIGINT This patch works fine together with patch for GDM bug #607738.
Comment on attachment 151989 [details] [review] safely quit when receiving SIGTERM and SIGINT Looks okay to me (well, I'd add the new lines after the g_debug call in signal_cb, but that's a detail). But let's wait for review of the gdm patch. Can you tell us when the gdm patch is accepted?
Vincent, thanks for reviewing the patch. I made a mistake, it makes more sense that the gdm bug depend on this bug.
Vincent, can you commit this patch? Let me know if you need my to commit.
Was the gdm patch approved (even if not committed)?
Vincent, the change for the GDM patch has been approved by Ray and me. Can we get the fix for gnome-session into 2.30? If so, let us know so we can coordinate the gdm fix at the same time.
Brian: I can commit it tonight, for 2.29.92. Does that work for you?
Sure, I'll put the gdm change into 2.29.92 also.
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.