You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We were surprised to find that if I backgrounded an infinite loop process in an mlogin session and then exited my shell, the mlogin job continued to run. It's stuck here, not having exited:
$ mlogin
* created interactive job -- c9c2f7ec-b546-ed22-ad0c-cde30d6feecb
* waiting for session... | established
dap@manta # while :; do :; done &
[1] 74678
dap@manta # exit
When we looked at one example, the process tree for the agent looked like this:
There's no child process of 3807, and that process appears to be doing basically nothing. It's in portfs, as we'd expect for an idle Node program. The last entries in the log are:
[2017-07-22T00:07:16.695Z] INFO: medusa-agent/3807 on dc5bfc46-d914-45b5-bafc-e713ef336f61: start (type=start, cwd=/, term=xterm-256color, columns=85, lines=80, command=/usr/bin/ctrun)
arguments: [
"-i",
"core",
"-l",
"child",
"/bin/bash",
"--norc"
]
[2017-07-22T00:07:16.722Z] INFO: medusa-agent/3874 on dc5bfc46-d914-45b5-bafc-e713ef336f61: started child process
We did not notice at first that the background bash process is still running, but it's been reparented to init:
Medusa is using pty.js here, and pty.js does not report the child having exited until it also gets a 'close' event on the pty. In this case, we have a child process that still has the pty open, so that's never going to happen. We initially worried this was a regression from #244, but it's not. It happens reliably with previous versions as well.
@jclulow points out that one may want the mlogin session to continue in this case (e.g., if you've forked a child subshell and killed the parent one). With mlogin it seems better to err on the side of keeping the session open, since terminating it unexpectedly is usually frustrating for users. If you manage to run into this, you can always terminate the session by cancelling the job.
So the conclusion is that we should just document this behavior.
The text was updated successfully, but these errors were encountered:
I've submitted PS2, which was a non-trivial rebase. On this patchset, the manual page looks normal in my terminal and the change is make prepush clean. The MPU tests were skipped on this deployment, but I don't think there's any risk to those in this change.
We were surprised to find that if I backgrounded an infinite loop process in an mlogin session and then exited my shell, the mlogin job continued to run. It's stuck here, not having exited:
When we looked at one example, the process tree for the agent looked like this:
There's no child process of 3807, and that process appears to be doing basically nothing. It's in portfs, as we'd expect for an idle Node program. The last entries in the log are:
We did not notice at first that the background bash process is still running, but it's been reparented to init:
It's pid 10821:
Medusa is using pty.js here, and pty.js does not report the child having exited until it also gets a
'close'
event on the pty. In this case, we have a child process that still has the pty open, so that's never going to happen. We initially worried this was a regression from #244, but it's not. It happens reliably with previous versions as well.Marlin's termination condition is just that the top level process exited. It's a reasonable question whether mlogin should have similar semantics. After #244, we could achieve that pretty easily by adding the "-o noorphan" flag to ctrun, which is essentially what Marlin itself does. You can test this using mlogin's
-c
option, and it does cause this example to terminate immediately when you exit the shell.@jclulow points out that one may want the mlogin session to continue in this case (e.g., if you've forked a child subshell and killed the parent one). With mlogin it seems better to err on the side of keeping the session open, since terminating it unexpectedly is usually frustrating for users. If you manage to run into this, you can always terminate the session by cancelling the job.
So the conclusion is that we should just document this behavior.
The text was updated successfully, but these errors were encountered: