www.cendio.com
Bug 5696 - Terminating a unity session on ubuntu 15.10 times out.
: Terminating a unity session on ubuntu 15.10 times out.
Status: CLOSED FIXED
: ThinLinc
Server OS
: 4.4.0
: PC Unknown
: P2 Normal
: 4.7.0
Assigned To:
:
:
:
: 5829
  Show dependency treegraph
 
Reported: 2015-10-30 14:51 by
Modified: 2016-12-05 12:13 (History)


Attachments
Logfile from a session termination timeout (34.89 KB, text/x-log)
2015-10-30 14:52, Henrik Andersson
Details
Patch to replace HUP with TERM (5.08 KB, patch)
2016-09-08 13:30, Henrik Andersson
Details
Patch to replace HUP with TERM (5.08 KB, patch)
2016-09-08 15:06, Henrik Andersson
Details


Note

You need to log in before you can comment on or make changes to this bug.


Description From cendio 2015-10-30 14:51:51
Reason being that we kill X server which kills session processes started by
upstart which in its turn, respawns the processes...
------- Comment #1 From cendio 2015-10-30 14:52:24 -------
Created an attachment (id=656) [details]
Logfile from a session termination timeout
------- Comment #2 From cendio 2016-08-25 15:47:08 -------
We should check if this still is a problem on 16.04 LTS
------- Comment #3 From cendio 2016-09-02 08:38:00 -------
16.04 also is affected by this problem. The reason being that out tl-xinit will
trap TERM signal an send HUP to client childs for hungup. However upstart is a
service and will just reload its configuration. While processes managed by
upstart receives a HUP signal they will shutdown, but as their jobs are
configured to respawn they will do.

A TERM signal to a users upstart process is taken as a request to shutdown.
This is the signal we should sent to upstart instead of HUP.

tl-xinit is a copy of the behavior of xinit regarding sending the  HUP to
processgroup for x client but on desktop environments sucha as gdm (fedora) and
lightdm (ubuntu), neither of them actually sends a HUP signal.
------- Comment #4 From cendio 2016-09-02 08:41:49 -------
Both lightdm and gdm will send TERM to client subprocess upon shutdown.
------- Comment #5 From cendio 2016-09-08 13:30:26 -------
Created an attachment (id=739) [details]
Patch to replace HUP with TERM
------- Comment #6 From cendio 2016-09-08 15:06:30 -------
Created an attachment (id=740) [details]
Patch to replace HUP with TERM

Fixed a typo
------- Comment #7 From cendio 2016-09-08 15:08:04 -------
(In reply to comment #6)
> Created an attachment (id=740) [details] [details]
> Patch to replace HUP with TERM
> 
> Fixed a typo

This patch also solve bug #5057 now when it actually waits for client
------- Comment #9 From cendio 2016-09-15 16:55:29 -------
A plain 'kill <pid>' on tl-xinit cleans up nicely. This is also true for a kill
of xsession.

However, a kill of the Xvnc child does not seem to be picked up by tl-xinit and
results in it dying, but tl-xinit, xsession and upstart remaining. Don't know
if this was supposed to be handled, was handled before, or what might actually
be a reasonable action in this case. A session without a display seems pretty
worthless, though...
------- Comment #10 From cendio 2016-09-19 10:56:38 -------
I'm seeing a strange effect on SLES12 which might be caused by this new
implementation:

$ ssh cendio@dhcp-253-81
Password: 
Last login: Mon Sep 19 12:45:56 2016 from scilla.lkpg.cendio.se
cendio@dhcp-253-81:~> pkill Xvnc
Connection to dhcp-253-81 closed by remote host.
Connection to dhcp-253-81 closed.

Strace shows:

# strace -p 90702
Process 90702 attached
read(0, 0x7ffdc6997a4f, 1)              = ? ERESTARTSYS (To be restarted if
SA_RESTART is set)
--- SIGTERM {si_signo=SIGTERM, si_code=SI_USER, si_pid=90530, si_uid=1000} ---
read(0, 0x7ffdc6997a4f, 1)              = -1 EIO (Input/output error)
--- SIGHUP {si_signo=SIGHUP, si_code=SI_KERNEL} ---
--- SIGCONT {si_signo=SIGCONT, si_code=SI_KERNEL} ---
rt_sigprocmask(SIG_BLOCK, [CHLD TSTP TTIN TTOU], [HUP INT ILL TRAP ABRT BUS FPE
USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], 8) = 0
ioctl(255, TIOCSPGRP, [90702])          = -1 ENOTTY (Inappropriate ioctl for
device)
rt_sigprocmask(SIG_SETMASK, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE
ALRM TERM XCPU XFSZ VTALRM SYS], NULL, 8) = 0
setpgid(0, 90702)                       = -1 EPERM (Operation not permitted)
rt_sigaction(SIGHUP, {SIG_DFL, [], SA_RESTORER|SA_RESTART, 0x7fe9c02ba140},
{0x432280, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU
XFSZ VTALRM SYS], SA_RESTORER, 0x7fe9c02ba140}, 8) = 0
kill(90702, SIGHUP)                     = 0
rt_sigreturn({mask=[]})                 = -1 EIO (Input/output error)
--- SIGHUP {si_signo=SIGHUP, si_code=SI_USER, si_pid=90702, si_uid=1000} ---
+++ killed by SIGHUP +++
------- Comment #11 From cendio 2016-09-21 09:29:48 -------
(In reply to comment #9)
> A plain 'kill <pid>' on tl-xinit cleans up nicely. This is also true for a kill
> of xsession.
> 
> However, a kill of the Xvnc child does not seem to be picked up by tl-xinit and
> results in it dying, but tl-xinit, xsession and upstart remaining. Don't know
> if this was supposed to be handled, was handled before, or what might actually
> be a reasonable action in this case. A session without a display seems pretty
> worthless, though...

This is not a regression. A new bug was created for the above problem, bug
#5999.
------- Comment #12 From cendio 2016-09-21 10:23:15 -------
(In reply to comment #10)
> I'm seeing a strange effect on SLES12 which might be caused by this new
> implementation:
> 
> $ ssh cendio@dhcp-253-81
> Password: 
> Last login: Mon Sep 19 12:45:56 2016 from scilla.lkpg.cendio.se
> cendio@dhcp-253-81:~> pkill Xvnc
> Connection to dhcp-253-81 closed by remote host.
> Connection to dhcp-253-81 closed.
> 
> Strace shows:
> 
> # strace -p 90702
> Process 90702 attached
> read(0, 0x7ffdc6997a4f, 1)              = ? ERESTARTSYS (To be restarted if
> SA_RESTART is set)
> --- SIGTERM {si_signo=SIGTERM, si_code=SI_USER, si_pid=90530, si_uid=1000} ---
> read(0, 0x7ffdc6997a4f, 1)              = -1 EIO (Input/output error)
> --- SIGHUP {si_signo=SIGHUP, si_code=SI_KERNEL} ---
> --- SIGCONT {si_signo=SIGCONT, si_code=SI_KERNEL} ---
> rt_sigprocmask(SIG_BLOCK, [CHLD TSTP TTIN TTOU], [HUP INT ILL TRAP ABRT BUS FPE
> USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], 8) = 0
> ioctl(255, TIOCSPGRP, [90702])          = -1 ENOTTY (Inappropriate ioctl for
> device)
> rt_sigprocmask(SIG_SETMASK, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE
> ALRM TERM XCPU XFSZ VTALRM SYS], NULL, 8) = 0
> setpgid(0, 90702)                       = -1 EPERM (Operation not permitted)
> rt_sigaction(SIGHUP, {SIG_DFL, [], SA_RESTORER|SA_RESTART, 0x7fe9c02ba140},
> {0x432280, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU
> XFSZ VTALRM SYS], SA_RESTORER, 0x7fe9c02ba140}, 8) = 0
> kill(90702, SIGHUP)                     = 0
> rt_sigreturn({mask=[]})                 = -1 EIO (Input/output error)
> --- SIGHUP {si_signo=SIGHUP, si_code=SI_USER, si_pid=90702, si_uid=1000} ---
> +++ killed by SIGHUP +++

Did some more tests. The SIGTERM comes from tl-xinit. Does not happen with
4.6.0.
------- Comment #15 From cendio 2016-09-29 14:28:41 -------
*** Bug 6015 has been marked as a duplicate of this bug. ***
------- Comment #17 From cendio 2016-10-03 14:37:22 -------
(In reply to comment #15)
> *** Bug 6015 has been marked as a duplicate of this bug. ***

Reproduced the issue mentioned in bug 6015 with 4.7.0beta1 and verified that
our example-profile for xterm/rxvt works with build 5252 no matter the order.
Closing.