After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 607658 - Should emit "EndSession" when receiving SIGTERM
Should emit "EndSession" when receiving SIGTERM
Status: RESOLVED FIXED
Product: gnome-session
Classification: Core
Component: gnome-session
git master
Other All
: Normal major
: ---
Assigned To: Session Maintainers
Session Maintainers
Depends on:
Blocks: 607738
 
 
Reported: 2010-01-21 13:54 UTC by Halton Huo
Modified: 2010-03-08 23:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch for bug #607658 (2.27 KB, patch)
2010-01-21 15:18 UTC, Halton Huo
needs-work Details | Review
safely quit when receiving SIGTERM and SIGINT (2.20 KB, patch)
2010-01-22 09:12 UTC, Halton Huo
committed Details | Review

Description Halton Huo 2010-01-21 13:54:41 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.
Comment 1 Halton Huo 2010-01-21 15:18:53 UTC
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 2 Vincent Untz 2010-01-21 15:53:15 UTC
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.
Comment 3 Halton Huo 2010-01-21 16:21:19 UTC
(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?
Comment 4 Vincent Untz 2010-01-21 16:56:14 UTC
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.
Comment 5 Halton Huo 2010-01-21 17:10:45 UTC
(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?
Comment 6 Halton Huo 2010-01-22 07:33:43 UTC
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?
Comment 7 Halton Huo 2010-01-22 09:12:00 UTC
Created attachment 151989 [details] [review]
safely quit when receiving SIGTERM and SIGINT

This patch works fine together with patch for GDM bug #607738.
Comment 8 Vincent Untz 2010-01-22 09:45:46 UTC
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?
Comment 9 Halton Huo 2010-01-22 21:53:33 UTC
Vincent, thanks for reviewing the patch. I made a mistake, it makes more sense that the gdm bug depend on this bug.
Comment 10 Halton Huo 2010-01-28 04:57:17 UTC
Vincent, can you commit this patch? Let me know if you need my to commit.
Comment 11 Vincent Untz 2010-01-28 10:53:33 UTC
Was the gdm patch approved (even if not committed)?
Comment 12 Brian Cameron 2010-03-08 21:27:43 UTC
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.
Comment 13 Vincent Untz 2010-03-08 21:34:02 UTC
Brian: I can commit it tonight, for 2.29.92. Does that work for you?
Comment 14 Brian Cameron 2010-03-08 21:42:28 UTC
Sure, I'll put the gdm change into 2.29.92 also.
Comment 15 Vincent Untz 2010-03-08 23:36:31 UTC
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.