Processes remain after log off

Bug #236210 reported by toobuntu
8
Affects Status Importance Assigned to Milestone
gdm (Ubuntu)
Invalid
Low
Unassigned

Bug Description

After logging out of a GNOME session, processes owned by the now-logged-out user still remain and interfere with subsequent logons. Because both bonobo-activation-server and gvfs-fuse-daemon are frequently the culprits, I am not sure to which package to attribute this bug (perhaps separate bug reports are needed for each aberrant process?).

e.g.
toobuntu@uw1:~$ w
 19:31:47 up 4:40, 1 user, load average: 0.00, 0.03, 0.09
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
toobuntu pts/0 uw5.local 17:23 0.00s 0.18s 0.00s w
toobuntu@uw1:~$ ps U cindy
  PID TTY STAT TIME COMMAND
 6538 ? Ss 0:00 /usr/lib/gvfs//gvfs-fuse-daemon /home/cindy/.gvfs #[toobuntu: note the double slash here]

My current workaround is to run 'ps U <username-of-user-who-logged-off>' and if any processes show up, to run my helper script:
$ cat /usr/local/bin/kill-stragglers
#!/bin/bash

# takes 1 argument: the username of the user who logged off

USER=$1
sudo kill -9 $( ps U $USER | grep -v TTY | awk '{print $1}' ) 2> /dev/null

-----

$ lsb_release -dr
Description: Ubuntu 8.04
Release: 8.04

$ apt-cache policy libbonobo2-0 gvfs-fuse
libbonobo2-0:
  Installed: 2.22.0-0ubuntu1
  Candidate: 2.22.0-0ubuntu1
  Version table:
 *** 2.22.0-0ubuntu1 0
        500 http://us.archive.ubuntu.com hardy/main Packages
        100 /var/lib/dpkg/status
gvfs-fuse:
  Installed: 0.2.4-0ubuntu1
  Candidate: 0.2.4-0ubuntu1
  Version table:
 *** 0.2.4-0ubuntu1 0
        500 http://us.archive.ubuntu.com hardy-proposed/main Packages
        100 /var/lib/dpkg/status
     0.2.3-0ubuntu5 0
        500 http://us.archive.ubuntu.com hardy-updates/main Packages
     0.2.3-0ubuntu4 0
        500 http://us.archive.ubuntu.com hardy/main Packages

Tags: proposed-pkg
Revision history for this message
toobuntu (toobuntu) wrote :

here's a more complete and more common list:

toobuntu@uw1:~$ w
 11:20:37 up 2 days, 20:29, 1 user, load average: 0.04, 0.16, 0.17
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
toobuntu pts/0 uw5.local Fri17 0.00s 0.22s 0.00s w
toobuntu@uw1:~$ ps U ed
  PID TTY STAT TIME COMMAND
20305 ? Ssl 0:00 /usr/lib/bonobo-activation/bonobo-activation-server -
20334 ? Ss 0:00 /usr/lib/gvfs//gvfs-fuse-daemon /home/ed/.gvfs
20404 ? Sl 0:00 /usr/lib/evolution/evolution-data-server-2.22 --oaf-a
21510 ? S 0:00 /usr/lib/libgconf2-4/gconfd-2 11
toobuntu@uw1:~$ kill-straglers ed
[sudo] password for toobuntu:
toobuntu@uw1:~$ ps U ed
  PID TTY STAT TIME COMMAND

Revision history for this message
toobuntu (toobuntu) wrote :

Well, I had to update the helper script, as it seems a complete X restart is really needed (not so helpful if multiple users are using the GUI, but okay if only 1 at a time):

$ cat /usr/local/bin/kill-stragglers
#!/bin/bash

# takes 1 argument: the username of the user who logged off

USER=$1
sudo kill -9 $( ps U $USER | grep -v TTY | awk '{print $1}' ) 2> /dev/null
sudo /etc/init.d/gdm restart

Revision history for this message
toobuntu (toobuntu) wrote :

@Dereck Wonnacott : The gdm restart was added for good measure, but why would you think to change the source package to Xorg? I do not think that this is an Xorg bug, rather separate bugs with bonobo-activation-server, gvfs-fuse-daemon, evolution-data-server, and gconfd-2. See Bug #49594, which is a dupe (but that report is limited to a discussion only of bonobo-activation-server; this report attempts to track all of the aberrant processes).

It seems that these processes are called by gdm, so a gdm restart gets us to a clean slate again. But these processes should, in and of themselves, know to terminate upon user log off. See a fuller discussion re: cleaning of GNOME processes at logoff at the link I posted here: https://bugs.launchpad.net/ubuntu/+source/gnome-session/+bug/49594/comments/33

Revision history for this message
Chris Coulson (chrisccoulson) wrote :

Sebastien - I've just been discussing this bug with Bryce on ubuntu-bugs, and he suggested contacting you for your opinion. We don't think this is an xorg bug, but we're not really sure what package to assign. Do you think this might be caused by separate bugs with each of the above mentioned processes (bonobo, gvfs-fuse-daemon, gconfd-2 etc), or caused by something like GDM or gnome-session?

Once we've decided, I can confirm the behaviour described in this report. I also see the same thing occasionally with tomboy

Thanks

Revision history for this message
Pacho Ramos (pacho) wrote :

Hi!

I am a gentoo user and suffer exactly the same issue: gvfs-fuse-daemon is not killed at end session (other times it simply crashes at exit). From my point of view, gvfs (0.2.5 in my case) is the culprit

Revision history for this message
toobuntu (toobuntu) wrote :

Here's my workaround that, once set up, requires no further intervention by the sysadmin (me) in our corporate environment:

In short, we are creating a shell script to kill all the remaining user processes after logging out of GNOME, setting that script suid root, and having gdm call that script upon log out.

$ cat /usr/local/bin/kill-stragglers-auto
#!/bin/bash

# takes 1 argument: the username of the user who logged off

USER=$1
sudo kill -9 $( ps U $USER | grep -v TTY | awk '{print $1}' ) 2> /tmp/kill-stragglers-auto.errors.log
sudo /etc/init.d/gdm restart

$ sudo chmod +s /usr/local/bin/kill-stragglers-auto

$ ls -lh /usr/local/bin/kill-stragglers-auto
-rwsr-sr-x 1 root root 213 Aug 27 18:32 /usr/local/bin/kill-stragglers-auto

$ cd /etc/gdm/PostSession

$ ls -lh
total 8.0K
-rwxr-xr-x 1 root root 395 Aug 27 18:30 Default
-rwxr-xr-x 1 root root 305 Aug 27 18:29 Default.080827.orig

$ tail Default
    fi
  done
  IFS=$OLD_IFS
  echo "$OUTPUT"
}

# the following was added by toobuntu on 080827:
/usr/local/bin/kill-stragglers-auto ${USER}

exit 0

Hope this helps someone!

Revision history for this message
toobuntu (toobuntu) wrote :

changed affected package to gdm, pending further investigation

Revision history for this message
toobuntu (toobuntu) wrote :

note that we only have user names without spaces or special characters. you may want to use brackets and quotes around the variables to get my workaround working in your environment.

Revision history for this message
toobuntu (toobuntu) wrote :

Improvement: Simply add 2 lines to /etc/gdm/PostSession/Default and do _not_ store a backup of Default in the PostSession directory.

$ ls /etc/gdm/PostSession/
Default

$ tail /etc/gdm/PostSession/Default
  done
  IFS=$OLD_IFS
  echo "$OUTPUT"
}

# the following 2 lines were added by toobuntu on 080828:
kill -9 $( ps U "${USER}" | grep -v TTY | mawk '{print $1}' ) 2> /tmp/kill-stragglers-gdm.errors
/etc/init.d/gdm restart

exit 0

-----
FYI- From http://www.gnome.org/projects/gdm/docs/2.14/configuration.html :

When the user terminates his session, the PostSession script will be run. Again operation is similar to Init, PostLogin and PreSession. Again the script will be run with root privileges, the slave daemon will block and the $USER environment variable will contain the name of the user who just logged out and $DISPLAY will be set to the display the user used, however note that the X server for this display may already be dead and so you shouldn't try to access it. Also $X_SERVERS environmental variable is set and this points to a fake generated X servers file for use with the sessreg accounting application.

Note that the PostSession script will be run even when the display fails to respond due to an I/O error or similar. Thus, there is no guarantee that X applications will work during script execution.

Revision history for this message
Sebastien Bacher (seb128) wrote :

the issue is not a gdm one, you should rather open bugs for buggy servers which don't have a bug open yet

Changed in gdm:
importance: Undecided → Low
status: New → Invalid
Revision history for this message
toobuntu (toobuntu) wrote :

2009-01-31 update - I just filed separate bugs against the following:
libbonobo (Bug #323604)
gvfs (Bug #323606)
evolution-data-server (Bug #323607)
gconf (Bug #323608)

If you still experience this issue with any of these, then please confirm those bugs so this issue can be fixed properly. In the meantime, there is an easy workaround listed in those bug reports that I don't see why it couldn't be adopted by Ubuntu as a default. There seems to be no harm done, and it solves this problem for all aberrant processes.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.