pidfile left after logout may cause critical issues

Bug #1077052 reported by Rafał Cieślak on 2012-11-09
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu Accomplishments Daemon
Rafał Cieślak

Bug Description

For some reason, the daemon's pidfile stays when user logs out or when system shuts down. I suspect this may be because the daemon does not receive a SIGTERM signal, but is KILLed instead.
In such case, next time the daemon is started, it will kill the pid that is stored in the pid file. Note that in a new session this may be a completely unrelated process!
Moreover, this makes the daemon startup much longer, especially if started from the viewer.

The ideal solution to this would be to make the pidfile disappear when the daemon is closed because of user logging out. I have investigated this, and it seems this may be almost impossible, the only reasonable way incorporates connecting to gnome-session, which would make the daemon depending on gnome DE. Not cool.

The alternative solution is to *never* try killing the daemon. We'll assume that twistd never locks down. That would change the startup procedure to: 1) check if pidfile exists, if not, start the daemon 2) if the file exists, try connecting to the daemon, if successful, then there is no need to start the daemon 3) if not successful, remove the pidfile for twistd and start the daemon.

summary: - pidfile left after logout makes next daemon start very long
+ pidfile left after logout may cause critical issues
Matt Fischer (mfisch) wrote :

Won't this get fixed by the move to dbus? If so let's mark it in-progress.

Indeed it will. Moving to DBus will introduce the 'alternative solution' explained in bug description, as we'll never try to kill anything when daemon is launched.

Matt Fischer (mfisch) on 2012-11-17
Changed in ubuntu-accomplishments-daemon:
status: New → In Progress

I pushed a fix to daemon laumcher that ignores the presence of pidfile, and makes sure it's removed before twistd starts.

Changed in ubuntu-accomplishments-daemon:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers