When the output asyncio.Future from extproc.subprocess_run  is cancelled, we make sure to terminate the process, but we do not kill or terminate any potential child processes.
 See bug 8232.
A situation like this can occur in loginhandler_common.py where we attach a timeout to the subprocess_run output with asyncio.wait_for when running session scripts present in /opt/thinlinc/etc/session*.d/.
This means that a session script could be written to start a process that runs forever, or until the vsmserver.service is restarted, which should be outside the scope of scripts meant to be run to completion before a user session is started.
We should therefore make sure to terminate lingering children of the process we create with subprocess_run when a timeout occurs.
Maybe a realistic example of this could be if the session script starts a process that hangs indefinitely.
The TAG states:
> Scripts in /opt/thinlinc/etc/sessionstartup.d and
> /opt/thinlinc/etc/sessionreconnect.d are run by the root user, on the
> VSM Server. Session information will not be sent back to the client
> until these scripts have completed. This makes it possible to ensure
> that commands have been run before the client connects to the VSM Agent.
Which makes it sound like these scripts are not expected to continue running after a timeout has triggered termination of the parent process.
It's unclear if this is a bug or feature as some cases might want the children to live on as background processes. We'll need to gather some more real world cases to see if there are any issues with the current approach.