reduce 90s session kill timeout if the session does not shutdown cleanly

Bug #1457400 reported by Johny George on 2015-05-21
164
This bug affects 35 people
Affects Status Importance Assigned to Milestone
lvm2 (Ubuntu)
Undecided
Unassigned
systemd (Ubuntu)
Low
Unassigned

Bug Description

I use Ubuntu 15.04 with Unity, I have a SSD drive also. Very recently onwards the ubuntu is taking long to shut down nearly 1:30 minutes.

I checked the shutdown log messages and I get the follow message.

A stop job is running for Session c2 of user ***** (25s/ 1min 30 s)

It count downs till 1:30 minutes and then shutdown the machine.

Why is it happening.

affects: friends-app (Ubuntu) → plymouth (Ubuntu)
Steve Langasek (vorlon) wrote :

plymouth is just the messenger. Reassigning to systemd, which is at least where the message comes from.

affects: plymouth (Ubuntu) → systemd (Ubuntu)
Martin Pitt (pitti) wrote :

Can you please start a debug shell as described in /usr/share/doc/systemd/README.Debian, shut down, and when it hangs run

  loginctl session-status c2 > /root/session-c2.txt

Apparently there is a process in your user session which does not shut down but hangs, so we need to find out what it is. If you run "loginctl session-status c2" you see which processes are remaining together with their PIDs, and you can kill them (hopefully it should just be one or two). After rebooting, please attach /root/session-c2.txt. Thanks!

Changed in systemd (Ubuntu):
status: New → Incomplete

c2 - johny (1000)
    Since: Thu 2015-05-21 20:02:35 CEST; 1min 18s ago
   Leader: 1297
     Seat: seat0; vc7
  Display: :0
  Service: lightdm; type x11; class user
  Desktop: ubuntu
    State: closing
     Unit: session-c2.scope
    `-2398 python2 linconnect_server.py

May 21 20:03:27 johny-laptop sudo[3055]: pam_unix(sudo:session): session closed for user root
May 21 20:03:32 johny-laptop systemd[1]: Stopping Session c2 of user johny.
May 21 20:03:32 johny-laptop org.freedesktop.Notifications[1774]: loading icon 'notification-info' caused error: 'Icon 'notification-info' not present in theme'
May 21 20:03:32 johny-laptop ca.desrt.dconf[2922]: g_dbus_connection_real_closed: Remote peer vanished with error: Underlying GIOStream returned 0 bytes on an async read (g-io-error-quark, 0). Exiting.
May 21 20:03:32 johny-laptop org.gnome.zeitgeist.Engine[2922]: g_dbus_connection_real_closed: Remote peer vanished with error: Underlying GIOStream returned 0 bytes on an async read (g-io-error-quark, 0). Exiting.
May 21 20:03:32 johny-laptop org.gnome.zeitgeist.Engine[2922]: [18:03:32.644653 WARNING] zeitgeist-daemon.vala:449: The connection is closed
May 21 20:03:32 johny-laptop sudo[2911]: pam_unix(sudo:session): session closed for user root
May 21 20:03:32 johny-laptop org.gnome.evolution.dataserver.Sources3[1774]: (evolution-source-registry:2011): GLib-GIO-CRITICAL **: g_dbus_interface_skeleton_unexport: assertion 'interface_->priv->connections != NULL' failed
May 21 20:03:32 johny-laptop org.gnome.evolution.dataserver.Sources3[1774]: (evolution-source-registry:2011): GLib-CRITICAL **: Source ID 1 was not found when attempting to remove it
May 21 20:03:32 johny-laptop org.gnome.evolution.dataserver.Sources3[1774]: (evolution-source-registry:2011): GLib-CRITICAL **: Source ID 2 was not found when attempting to remove it

This is linconnect.
https://github.com/hauckwill/linconnect-server
It used to work fine. Suddenly this happened.
I use it for mirroring Android Notifications.
I have enabled it in start up applications, when I removed it from start up applications the shut down time is back to normal.
Why is this happening ? Why is shutdown process not able to kill it. ?

Martin Pitt (pitti) on 2015-05-22
summary: - Ubuntu taking long to shutdown
+ linconnect_server.py hangs on shut down

What happens at shutdown is that all processes are sent SIGTERM, so that they have a chance to intercept, save their state/clean up, etc. After a timeout (default 90s) SIGKILL is sent. So it seems linconnect_server.py does not actually shut down on SIGTERM?

I tried to download and install it, but the install.sh crashed in pip with

Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 304, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1178, in prepare_files
    url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 292, in find_requirement
    elif is_prerelease(version) and not (self.allow_all_prereleases or req.prereleases):
  File "/usr/lib/python2.7/dist-packages/pip/util.py", line 739, in is_prerelease
    return any([any([y in set(["a", "b", "c", "rc", "dev"]) for y in x]) for x in parsed])
TypeError: 'int' object is not iterable

Can you try "pkill -fe linconnect_server.py" in a running session and see if linconnect_server continues to run after that?

I ran the command .
johny@johny-laptop:~$ pkill -fe linconnect_server.py
python2 killed (pid 2469)

But its not actually getting killed.

If I go to system monitor and see, the process is still there.

If I kill the process by right clicking it System monitor and pressing kill. The process gets killed. And when I try to shut-down after that its back to normal.

If you could see this, I installed it like this.
http://www.webupd8.org/2014/01/get-android-notifications-on-your.html
There was no exception and it works nicely.

I have been using it for very long, its not something that I installed recently. Its been working fine for long. But this problem only started recently only.

Martin Pitt (pitti) wrote :

This probably got introduced with the fix for bug 1448259. So, this general behaviour is "correct" in the sense that processes should not be killed immediately after SIGTERMing them. But 90s is a bit much for session shutdowns, this could be reduced to something like 30 s. This is still a long session shutdown, but you really wan this if e. g. LibreOffice asks you about unsaved documents and the like.

I don't know what the timeout under upstart was, but apparently it was a lot smaller.

summary: - linconnect_server.py hangs on shut down
+ reduce 90s session kill timeout if the session does not shutdown cleanly
Changed in systemd (Ubuntu):
status: Incomplete → Confirmed
importance: Undecided → Low

Reducing the the time to 30s if it doesn’t kill properly would be a good idea.

I have reported a bug with the developer of linconnect as well.

https://github.com/hauckwill/linconnect-server/issues

BronsonMathews (bronsonmathews) wrote :

im getting this on 15.10, and its driving me nutz...
Is there a way to find out what is causing it, or to change the timeout to 10seconds or so?

QkiZ (qkiz) wrote :

How to change timeout value? In which config file I find this setting?

OpenFerret (q-rob-z) wrote :

I am also getting this error under Ubuntu 15.10 AMD64. I seems to have an issue dropping my encrypted LVM PV and just cycles around for 1:30...

Which is pretty irritating.

kernelOfTruth (dalinuxlova) wrote :

/etc/systemd/system.conf

or a similar file should be your friend

http://www.freedesktop.org/software/systemd/man/systemd-system.conf.html

search for

DefaultTimeoutStartSec=
DefaultTimeoutStopSec=
TimeoutSec=

and enter lower values

Thanks. It helps :-)

Thanks,
Johny George

On Wednesday 13 January 2016 10:06 PM, kernelOfTruth wrote:
> /etc/systemd/system.conf
>
> or a similar file should be your friend
>
> http://www.freedesktop.org/software/systemd/man/systemd-system.conf.html
>
> search for
>
> DefaultTimeoutStartSec=
> DefaultTimeoutStopSec=
> TimeoutSec=
>
>
> and enter lower values
>

Launchpad Janitor (janitor) wrote :

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

Changed in lvm2 (Ubuntu):
status: New → Confirmed
Andre T (wind-kitesurfer) wrote :

Hi

Had the same issue with a VirtualBox Ubuntu Mate 16.04.
I upgrade kernel to version 4.6.3 and for the time being the issue is gone.

Thanks

A

Pheeble (enpheebled-git) wrote :

These timeout problems would be much easier to diagnose if systemd simply wrote a log entry instead of requiring a debug shell.

Con Kolivas (kernel-kolivas) wrote :

I'm still experiencing this problem on upgrading to ubuntu 16.10

menin (valmen) wrote :

Usung Kubuntu 16.04, I've got the same problem. I don't understand why we're having that problem.

Hicks (hicks1gb) wrote :

A stop job is running for ifup for wlp2s0

Hicks (hicks1gb) wrote :

...

nmaxx (nmaxx) wrote :

I have the same issue on one of my machines running 16.04.
"A stop job is running for Session c2 of user ..."

nmaxx (nmaxx) wrote :

Btw. there is this upstream bug report:
https://bugs.freedesktop.org/show_bug.cgi?id=70593
This one was closed two days ago because they believe it was fixed.
Maybe there is a fix that can be pulled from upstream, or maybe they are wrong and the bug is still there on their end.

Rich Fiekowsky (raf55) wrote :

I also experienced "A stop job is running for Session c2 ... / 1min 30 s)". Newbies (like me) might need to know that in a fresh install of Ubuntu 16.04, the file /etc/systemd/system.conf has (almost) all lines commented out with a # . So, in addition to changing the number in the line #DefaultTimeoutStopSec=90 , one must also remove the # at the beginning of the line, to uncomment it. Also, before I changed the conf file, I had fast restarts sometimes by logging out before I restarted.

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

Other bug subscribers

Remote bug watches

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