Reason being that we kill X server which kills session processes started by upstart which in its turn, respawns the processes...
Created attachment 656 [details] Logfile from a session termination timeout
We should check if this still is a problem on 16.04 LTS
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.
Both lightdm and gdm will send TERM to client subprocess upon shutdown.
Created attachment 739 [details] Patch to replace HUP with TERM
Created attachment 740 [details] Patch to replace HUP with TERM Fixed a typo
(In reply to comment #6) > Created an attachment (id=740) [details] > Patch to replace HUP with TERM > > Fixed a typo This patch also solve bug #5057 now when it actually waits for client
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...
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 +++
(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.
(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.
*** Bug 6015 has been marked as a duplicate of this bug. ***
(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.