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

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

    [ https://issues.apache.org/jira/browse/MESOS-8978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16502455#comment-16502455 ] 

Kevin Klues commented on MESOS-8978:
------------------------------------

Why don't I have this problem with the DC/OS CLI and launching {{sh -i`}}?

My command line looks similar:
{noformat}
dcos task exec --tty --interactive <task-id> /bin/sh -i
{noformat}

and it works just fine

Concrete example I just ran:
{noformat}
$ dcos task exec -it sleep /bin/sh -i
sh-4.3#  ls                                                                                                                                                  
containers  stderr  stderr.logrotate.conf  stdout  stdout.logrotate.conf
{noformat}

However, without the {{-it}} flags I see the same error as you:
{noformat}
$ dcos task exec sleep /bin/sh -i
sh: cannot set terminal process group (48): Inappropriate ioctl for device
sh: no job control in this shell
sh-4.3#
{noformat}

Are you sure there aren't issues with the way `msh` interprets the `-tty` and `-interactive` flags?

> 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.4.1, 1.5.1, 1.6.0
>            Reporter: Jie Yu
>            Priority: Major
>
> 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 an interactive shell in the Mesos cluster. It works by launching 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)