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 60697 - Gnome session manager fails to kill program it starts
Gnome session manager fails to kill program it starts
Status: RESOLVED WONTFIX
Product: gnome-session
Classification: Core
Component: smproxy
1.5.x
Other All
: Normal minor
: 2.0.1
Assigned To: Session Maintainers
Session Maintainers
: 2124 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2001-09-18 15:11 UTC by Christian Marillat
Modified: 2014-12-15 20:57 UTC
See Also:
GNOME target: ---
GNOME version: 2.9/2.10


Attachments
patch to add gnome-session-wrapper program (6.81 KB, patch)
2006-10-02 00:54 UTC, Tom Tromey
none Details | Review
updated patch (7.25 KB, patch)
2006-10-02 17:38 UTC, Tom Tromey
none Details | Review
updated to use glib main loop (7.31 KB, patch)
2006-10-12 03:00 UTC, Tom Tromey
none Details | Review

Description Christian Marillat 2001-09-18 15:11:55 UTC
Hi,

Under the Gnome Control Center there is a list of programs that need
to be started explicitly by the session manager at the start of the
session because the program doesn't implement the session management
communication conventions and thus won't get included as part of the
session when it is saved.

To this list I have added a program which talks to a modem and to esd
but doesn't use X at all.  When I log out the session manager does not
kill this program so when I next log in a second copy is started, and
so on.

Since the program got started by the session manager when I log in, to
my way of thinking the session manager should kill it again when the
session finished (i.e. I log out) in the same way that processes using
a terminal get a SIGHUP which kills them when the user logs out of a
stardard terminal session.

I suspect this has not come to light before because most programs that
are added to this list of extra programs to start do use X and
therefore get killed when the X server is reset.  Nevertheless I think
killing these programs is the session manager's job and hence this bug
report.

On a related point, I notice that the programs that get started by the
session manager all appear to have init as their parent process
whereas it would seem more logical if these retained gnome-session as
the parent process - that way if a use if logged in more than once it
would be possible to tell the two sessions appart.
Comment 1 Mark McLoughlin 2002-04-15 12:10:57 UTC
Hmm, I think this is actually smproxy's job, but that's only a first
guess. This needs to be looked at closely ...
Comment 2 Elijah Newren 2003-08-20 16:28:16 UTC
*** Bug 2124 has been marked as a duplicate of this bug. ***
Comment 3 Elijah Newren 2003-08-20 16:32:48 UTC
Bug 2124 had the GNOMEVER2.3 keyword, so I'm adding it here as well.
Comment 4 Kjartan Maraas 2005-01-04 22:33:39 UTC
Has this changed in later releases?
Comment 5 Josselin Mouette 2005-01-05 12:26:34 UTC
In the Debian package I have included a patch to kill the esd process upon exit,
but this is a crude hack. I can attach it if someone is interested.
Comment 6 Tom Tromey 2006-09-30 21:21:04 UTC
FYI -- the init-as-parent thing is fixed by the patch in bug #101351.

I think there are two possible resolutions to this bug.

One is to write a simple wrapper program which connects to the session
manager and runs a child process.  Then, when the session manager exits,
it would kill its child.

Another idea is that, in conjunction with the proper parenting patch,
gnome-session could make a new process group and, on exit, send
SIGHUP to all members of that process group.  This approach is a bit
more general but also less flexible.
Comment 7 Tom Tromey 2006-10-02 00:54:01 UTC
Created attachment 73821 [details] [review]
patch to add gnome-session-wrapper program

This patch adds a new "gnome-session-wrapper" program.
This program can be used to wrap non-session-aware programs.
It will manage them in a very simple way: it will start them, register
itself with the session as appropriate, and when the session exits it
will send the child a SIGHUP.
This ought to suffice for programs that don't have session management
capability (and never will).
Comment 8 Tom Tromey 2006-10-02 17:38:43 UTC
Created attachment 73873 [details] [review]
updated patch

This is an updated patch which handles command-line option parsing
correctly.
Comment 9 Vincent Untz 2006-10-08 15:29:50 UTC
Looks great. We don't need to link to gtk+ though (although it might happen because of libgnome...). Using a GMainLoop should be enough.
Comment 10 Tom Tromey 2006-10-10 02:35:55 UTC
I just followed existing style in that directory.
E.g., see gsm-remove-client.c.
I will update the patch when I have a chance.
Comment 11 Tom Tromey 2006-10-12 03:00:43 UTC
Created attachment 74533 [details] [review]
updated to use glib main loop

I've updated the patch to use the glib main loop
Comment 12 Ray Strode [halfline] 2006-11-07 19:58:25 UTC
Hi Tom,

So is the idea that people would manually add the wrapper to the autostart desktop files?

Should we add the wrapper automatically with gnome-session-properties?
Comment 13 Dan Winship 2006-11-07 20:55:36 UTC
Is there any reason gnome-session doesn't just call setpgrp() at startup and then kill its entire process group immediately before exiting?
Comment 14 Tom Tromey 2007-01-06 18:55:05 UTC
In re #12: yeah, the idea is that the wrapper would be used by
programs which are not and never will be session-aware themselves.
Unfortunately this isn't a property you can auto-detect so adding
it automatically seems difficult.

In re #13: we could do that.  My only reluctance is that we don't
know all the ramifications of doing it.  I suppose most programs
that care will do something smart with SIGHUP already though.
Comment 15 Vincent Untz 2007-01-07 12:52:34 UTC
Tom: do you think adding a checkbox to the "Edit startup program" dialog, stating "Is not session aware", would be enough? Then, users could easily use this feature. Not sure that enabling this for a session-aware program would be good, though ;-)
Comment 16 Ray Strode [halfline] 2014-12-15 20:57:27 UTC
at this point I think we should close this bug...  Applications that want to die when the session goes away can listen for the bus going away, or use the session management protocol, or listen for X going away...

Furthermore, at some point, systemd will probably handle this by killing the whole cgroup.

Reopen if you strongly disagree.