Although the comment in the code states otherwise, tl-xinit will not terminate a session because just the X server dies. It will wait until the client is also dead.
Although the client almost always terminates when the X server goes away, this isn't always the case. So we should make sure a missing Xvnc is also sufficient.
One note though is that we probably want to run xlogout.d in this scenario as well. Unfortunately we have no way of forcing this to happen, but we could at least give it a few seconds and hope it runs.
A lot of work was done on tl-xinit on bug 5696, but unfortunately this issue still remains. Tested with the current nightly build and 'bash -c "sleep 1000"' as the session command.
*** Bug 5999 has been marked as a duplicate of this bug. ***
For reference, this bug was introduced in r21424 as part of bug 357.
Make sure to test both X server terminating first, and client terminating first.
Bonus points for testing with the other ignoring SIGTERM as well.
To test that it's fixed, I started a client. In the client, I paused a process (e.g, "gnome-session-binary") and from the server I terminated Xvnc and verified that no other processes from the client was running in the background.
Another check I did was to paused Xvnc from the client. From the server I terminated gnome that was running on the client and checked that it did indeed close the client without having client processes in the background.
To make sure that this fix didn't break anything, I terminated the session in different ways and verified that the session was terminated. I did the following tests:
1) Terminate session by logging out normally
2) Set the -MaxDisconnectionTime 60 and with until client got disconnected
3) Terminate client from tlwebadmin interface
4) Terminate Xvnc from server
5) Selecting "End existing session" from the tl client