You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mesos.apache.org by "Jie Yu (JIRA)" <ji...@apache.org> on 2018/06/05 19:38:00 UTC

[jira] [Created] (MESOS-8978) Command executor calling setsid breaks the tty support.

Jie Yu created MESOS-8978:
-----------------------------

             Summary: Command executor calling setsid breaks the tty support.
                 Key: MESOS-8978
                 URL: https://issues.apache.org/jira/browse/MESOS-8978
             Project: Mesos
          Issue Type: Bug
    Affects Versions: 1.6.0, 1.5.1, 1.4.1
            Reporter: Jie Yu


I was playing with [msh|https://github.com/mesos/mesos-go/blob/master/api/v1/cmd/msh/msh.go] (one example from [mesos-go|https://github.com/mesos/mesos-go]), which allows you to launch a interactive shell in the Mesos cluster. It works by launch a container with tty enabled, and then [attach to the container input|https://github.com/apache/mesos/blob/master/include/mesos/v1/agent/agent.proto#L191-L201] using the agent operator API.

However, I got the following error when doing the following:
{noformat}
Jies-MacBook-Pro:mesos-go jie$  ./msh -master 127.0.0.1:5050 -tty -interactive -- /bin/sh -i
...
2018/06/05 11:51:35 original window size is 156 x 45
sh: cannot set terminal process group (-1): Inappropriate ioctl for device
sh: no job control in this shell
{noformat}

If I use `-pod`, the problem goes away. This only happens if command executor is used.

A few research suggested that this issue is related to `setsid` (see this [thread|https://github.com/Yelp/dumb-init/issues/51#issuecomment-227792216]). Looks like we did an extra `[setsid|https://github.com/apache/mesos/blob/1.6.x/src/launcher/executor.cpp#L512]` in the command executor.

The setsid() system call to create a new process group detaches the spawned process from a controlling tty. Therefore programs like bash complain, that they can't use job control. Re-attaching the controlling tty won't work, because the tty is still in use as a controlling tty for the command executor process.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)