You are not logged in.

#1 2018-02-08 00:03:32

brettski
Member
Registered: 2013-06-21
Posts: 18
Website

Need to quit Firefox/Chrome before issuing 'shutdown'?

Should Firefox and Chrome be shutdown before issuing a shutdown/poweroff/restart command? When I power down with them open, I get an error the next time I launch which invites me to restore my session.

I like to think that when 'shutdown' is issued, it would sigterm() my browser and the browser would have time to stop itself and exit cleanly. However, at least in my case, this doesn't seem to be happening. I have read posts from 2010 about possible issues with terminating a X11 session forcing a kill of gui programs but 2010 is a long time ago and I imagine things may have changed since then (plus, I'm on wayland anyway).

Really making this post to see if this is the behaviour that others are experiencing. IE, should I just get into the habit of closing out of my browser sessions when powering down? is there something going wrong on my system? or a way to configure my comp to be able to power down willy-nilly with everything open and not get pestered about restoring tabs?

P.S.
Interstingly, I have noticed that if I add hangouts desktop app (a Chrome extension) to my list of startup programs via the gnome-tweak-tool, Chrome will then launch without complaint... I imagine that in this case, it is just defaulting to 'restore session'. Anyone have any insight on this?

Offline

#2 2018-02-08 00:30:00

Batou
Member
Registered: 2017-01-03
Posts: 259

Re: Need to quit Firefox/Chrome before issuing 'shutdown'?

You should always shutdown web browsers manually because they always have lots of data to sync back to disk. Problem you're seeing can be explained by the timeout. There's a limit how much time a process has after it receives SIGTERM and then gets the SIGKILL. If it doesn't sync everything back in time, you get the error. This timeout is now configured within systemd (everything's now inside of systemd... unfortunately). I think it's either 10 or 90sec. Don't remember which.

man 5 systemd.kill 

PS: Chrome/Chromium, by default, doesn't even quit all the programs it's running after you exit them. Some processes are still running in the background after you quit! And those could be causing the "Restore" message you're seeing. It's best to disable that option so when you Ctrl+Q, you quit it for good.


Please vote for all the AUR packages you're using. You can mass-vote for all of them by doing: "pacman -Qqm | xargs aurvote -v" (make sure to run "aurvote --configure"  first)

Offline

#3 2018-02-08 00:42:33

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: Need to quit Firefox/Chrome before issuing 'shutdown'?

Batou wrote:

There's a limit how much time a process has after it receives SIGTERM and then gets the SIGKILL...

This may not be relevant as a large portion of gui programs do not handle SIGTERM: they rely on the window manager to send the appropriate messages (XDestroyWindow on X11, I have no idea what that'd be on Wayland).

Unfortunately, some WMs also do not handle SIGTERM (and/or fail to send the appropriate messages to clients and wait for them to shut down).

More info:
https://bbs.archlinux.org/viewtopic.php?id=192454
https://bbs.archlinux.org/viewtopic.php?id=179489

Last edited by Trilby (2018-02-08 00:44:14)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#4 2018-02-08 00:55:10

brettski
Member
Registered: 2013-06-21
Posts: 18
Website

Re: Need to quit Firefox/Chrome before issuing 'shutdown'?

Trilby wrote:

large portion of gui programs do not handle SIGTERM: they rely on the window manager to send the appropriate messages (XDestroyWindow on X11, I have no idea what that'd be on Wayland).

Having the same issue in X11 (both using Gnome).

Thanks for the links! Similar to what I had been reading before posting. Surprised that there hasn't been any progress on this front since 2015.

Offline

#5 2018-02-08 01:15:59

bulletmark
Member
From: Brisbane, Australia
Registered: 2013-10-22
Posts: 675

Re: Need to quit Firefox/Chrome before issuing 'shutdown'?

I've used chrome on Arch GNOME for many years and it always used to get closed down correctly on system/GNOME shutdown. Around early 2014 some update broke this and since then I have to press that ugly restore button every morning(!) E.g. here is a related discussion https://bbs.archlinux.org/viewtopic.php?id=183683. I'm running on Wayland nowadays and the problem still occurs but it started back in Xorg days.

Offline

#6 2018-02-08 01:26:43

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: Need to quit Firefox/Chrome before issuing 'shutdown'?

brettski wrote:

Thanks for the links! Similar to what I had been reading before posting. Surprised that there hasn't been any progress on this front since 2015.

There are solutions in the threads I linked.  How much more progress than that would you expect?


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#7 2018-02-08 04:26:15

brettski
Member
Registered: 2013-06-21
Posts: 18
Website

Re: Need to quit Firefox/Chrome before issuing 'shutdown'?

Trilby wrote:

There are solutions in the threads I linked.  How much more progress than that would you expect?

I simply meant that I am surprised that the browser and window manager developers haven't resolved.


Actually, according to the comments of one of the solutions from the link you posted, this issue should have been resolved (aur : chrome-shutdown-hook) however, I tried resetting my profile and it didn't solve the issue.

Offline

#8 2018-02-08 11:42:03

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: Need to quit Firefox/Chrome before issuing 'shutdown'?

brettski wrote:

I simply meant that I am surprised that the browser and window manager developers haven't resolved.

In what way do you think they should resolve it?  Do you believe it is a bug in a particular piece of software?  If so, report it to the developers of that software.  I don't really think it is.  It is just that you are unhappy with how your various bits of software are put together.  In that case, change how they are put together; it is your system afterall.

brettski wrote:

Actually, according to the comments of one of the solutions from the link you posted, this issue should have been resolved (aur : chrome-shutdown-hook)

In what way is that a real resolution that my code in those threads isn't?  I wrote something that fixes the problem.  Someone else wrote something that they thought would fix the problem.  Neither one of these are an upstream change (though that other user falsely attributes their code to google ... it is not from google).

brettski wrote:

however, I tried resetting my profile and it didn't solve the issue.

Yup.  I'd expect as much after just looking at the code for that aur package.  Notwithstanding the fact that it is completely incorrectly packaged, it actually does absolutely nothing to fix the problem at hand.  It sends SIGTERM to chromium.  There are two major problems with this: if the browsers in question responded to SIGTERM, this would not be an issue, so sending them an extra SIGTERM will not help.  Second, that aur package you linked to only sends SIGTERM to chromium, not to chrome nor to firefox which are your issue.

My code in those thread does send a signal to *all* X11 clients and sends a message they will hear.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB