Redshift does not quit upon logout from session

Bug #677783 reported by mtvoid
66
This bug affects 13 people
Affects Status Importance Assigned to Milestone
Redshift
Confirmed
Medium
Unassigned
redshift (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Redshift does not seem to be managed by the desktop session. So, when gtk-redshift is launched upon login to the desktop, it spawns a redshfit process, but it is not terminated when logging out. Logging in again launches a new redshift process; doing this a few times will lead to multiple stray redshift processes hanging around (you can see it by 'pidof redshift'). This is clearly not the correct behaviour, there should only be one instance of redshift running, and it should die when the session exits.

Tags: patch
Revision history for this message
Paul Natsuo Kishimoto (khaeru) wrote :

I can confirm this.

Changed in redshift:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in redshift (Ubuntu):
status: New → Confirmed
Revision history for this message
David F. (malteworld) wrote :

The problem arises because upon session end gtk-redshift receives SIGTERM, which prevents python from running the "finally" section. The included patch registers a signal handler, which calls sys.exit(), which in turn leads to python executing the "finally" section, where the child process is terminated.

Revision history for this message
David F. (malteworld) wrote :

Unfortunately, the previous method is not optimal because SIGKILL cannot be intercepted. One could however call prctl.set_pdeathsig() (analogous to PR_SET_PDEATHSIG of prctl(2)) after forking in the child process.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Intercept and forward SIGTERM" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-reviewers team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
Revision history for this message
Ryan S Kingsbury (ryanskingsbury) wrote :

Confirmed on Fedora x64 with Gnome 3.4.

Revision history for this message
ricardofunke (ricardo-funke) wrote :

Hi,

I'm affected by this bug and I see that it's kinda old. So does redshift is discontinued? Any chance of solving it?

I'm using Gnome 3 and I tryed some workarounds wighout success like .bash_logout, or /etc/gdm/PostSession/Default.

Does you have some other tips for me?

Thanks in advance and best regards.

Revision history for this message
David F. (malteworld) wrote :

I wrote the author/maintainer a couple of months ago to see, if he's still active. No response so far.
That leaves us (and me) the possibility to fork redshift into a PPA.

For the time being you can apply either of my patches (preferably the latter) to /usr/share/pyshared/gtk_redshift/statusicon.py, if you don't want to rebuild from source.

Revision history for this message
ricardofunke (ricardo-funke) wrote :

Hi David,

I applied the patch "Call prctl.set_pdeathsig() after forking" but it still doesn't kill the process at logout.

After applied, I removed statusicon.pyc and statusicon.pyo and then ran "python2 -m compileall statusicon.py" to regenerate.

But the problem persists, I log out from my account and log in into my wive's account, there I still can see my redshift process running with ps command, the only process remaining from my user.

Revision history for this message
David F. (malteworld) wrote :

Hm, the patch was definitely applied correctly and python would usually recompile outdated object files.
You probably did, but I'm asking just to make sure: did you terminate the old remaining processes "redshift" and "gtk-redshift", and install "python-prctl", the dependency introduced by the patch? Does gtk-redshift spill any interesting messages when run from command line?

Revision history for this message
Jon Lund Steffensen (jonls) wrote :

I've been working on an update for gtk-redshift to be able to provide more information to the user. That has meant that I've had to rewrite most of the process management code and for that reason I'm not sure how this discussion applies any more. If you want to take a look the code is here: https://github.com/jonls/redshift/tree/interactive-gui . A sigterm handler is installed and it seems to take care of shutting down the child process properly. However, even with a SIGKILL the child process seems to be shut down seemingly contrary to what David said in #4.

Revision history for this message
deutrino (deutrino) wrote :

This is still a problem. Who is the maintainer that can review the patch(es)? Downgrading to a PPA isn't great.

Revision history for this message
deutrino (deutrino) wrote :

Per http://jonls.dk/redshift/

"The project is managed at GitHub where issues and pull requests can also be posted. Please don’t use the old bug tracker at the Launchpad project page anymore."

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

Duplicates of this bug

Other bug subscribers

Remote bug watches

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