{"action":"created","issue":{"url":"https://api.github.com/repos/jonls/redshift/issues/263","labels_url":"https://api.github.com/repos/jonls/redshift/issues/263/labels{/name}","comments_url":"https://api.github.com/repos/jonls/redshift/issues/263/comments","events_url":"https://api.github.com/repos/jonls/redshift/issues/263/events","html_url":"https://github.com/jonls/redshift/issues/263","id":110824119,"number":263,"title":"Child process redshift is not terminated properly if redshift-gtk receives a signal","user":{"login":"Unode","id":122319,"avatar_url":"https://avatars.githubusercontent.com/u/122319?v=3","gravatar_id":"","url":"https://api.github.com/users/Unode","html_url":"https://github.com/Unode","followers_url":"https://api.github.com/users/Unode/followers","following_url":"https://api.github.com/users/Unode/following{/other_user}","gists_url":"https://api.github.com/users/Unode/gists{/gist_id}","starred_url":"https://api.github.com/users/Unode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Unode/subscriptions","organizations_url":"https://api.github.com/users/Unode/orgs","repos_url":"https://api.github.com/users/Unode/repos","events_url":"https://api.github.com/users/Unode/events{/privacy}","received_events_url":"https://api.github.com/users/Unode/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-10T23:51:23Z","updated_at":"2015-10-21T04:37:29Z","closed_at":null,"body":"This looks like a bug in the way redshift-gtk communicates and passes signals to the child process (redshift). Possibly related to #253 and #218.\r\n\r\nIf a signal other than SIGUSR1 is sent to the parent process (`redshift-gtk`), the children process (`redshift -v`) may be left running while the parent exits.\r\n\r\nSteps to reproduce:\r\n\r\n    1) During a night period start \"redshift-gtk\" and wait enough time to let the screen tone stabilize\r\n    2) Monitor all processes called redshift or redshift-gtk\r\n    3) Run \"pkill -TERM redshift-gtk\"\r\n    4) The screen remains in night tone and \"redshift -v\" should still be visible in the process list while redshift-gtk exited cleanly.\r\n\r\nIf the signal is sent during the tone change (gradient) phase `redshift -v` will exit but only due to a broken pipe error caused by producing output to a parent that is no longer there.\r\nThis can be confirmed by running the same steps above that lead to an orphan `redshift -v` process and then run:\r\n\r\n    5) pkill -TERM redshift\r\n\r\nThis would normally transition to the \"normal\" state before exiting. However in this case the process dies immediately and leaves the screen in night tone.\r\n\r\nIf [redshift-gtk](https://github.com/jonls/redshift/blob/master/src/redshift-gtk/statusicon.py#L72) is modified to run the child process as `redshift` instead of `redshift -v` the broken pipe problem is no longer visible and step 5) will perform the transition to \"normal\" tone.\r\nHowever this change is not sufficient to solve the initial problem of the orphaned `redshift` process.\r\n\r\nThe best solution would be for `redshift-gtk` to **wait** for the child process to finish before exiting, much like the `Quit` menu action does."},"comment":{"url":"https://api.github.com/repos/jonls/redshift/issues/comments/149781129","html_url":"https://github.com/jonls/redshift/issues/263#issuecomment-149781129","issue_url":"https://api.github.com/repos/jonls/redshift/issues/263","id":149781129,"user":{"login":"jonls","id":420734,"avatar_url":"https://avatars.githubusercontent.com/u/420734?v=3","gravatar_id":"","url":"https://api.github.com/users/jonls","html_url":"https://github.com/jonls","followers_url":"https://api.github.com/users/jonls/followers","following_url":"https://api.github.com/users/jonls/following{/other_user}","gists_url":"https://api.github.com/users/jonls/gists{/gist_id}","starred_url":"https://api.github.com/users/jonls/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonls/subscriptions","organizations_url":"https://api.github.com/users/jonls/orgs","repos_url":"https://api.github.com/users/jonls/repos","events_url":"https://api.github.com/users/jonls/events{/privacy}","received_events_url":"https://api.github.com/users/jonls/received_events","type":"User","site_admin":false},"created_at":"2015-10-21T04:37:29Z","updated_at":"2015-10-21T04:37:29Z","body":"Thanks! I wrote some quick code in #268 to fix what I think is the problem. I didn't have time to test it yet but I'll get back to it later. If you have any suggestions on the pull request or if you can test it, please let me know!"}}