[ https://issues.apache.org/jira/browse/MESOS-8978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16665773#comment-16665773 ]
Kevin Klues commented on MESOS-8978: ------------------------------------ {noformat} commit 4fa080a7eefd47697b9fab934d19c73f092c78f8 (HEAD -> master, origin/master) Author: Kevin Klues <klue...@gmail.com> Date: Fri Oct 26 16:49:32 2018 -0700 Fixed bug in 'execute.cpp' with tty-based tasks and no 'containerInfo'. Previously, we could only launch tasks using the '--tty' flag if they had a backing docker image (or some other combination of other flags set that would cause the task to have a 'containerInfo' created for it). This commit makes sure that if '--tty' is passed, that a containerInfo gets created and its TTYInfo field gets populated. Review: https://reviews.apache.org/r/69103/ {noformat} > 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, 1.7.0 > Reporter: Jie Yu > Assignee: Kevin Klues > Priority: Major > Fix For: 1.5.2, 1.6.2, 1.7.1, 1.8.0 > > > 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. > There are two possible solutions: > 1) Get rid of setsid in command executor > 2) Detach and re-attach the controlling TTY as suggested in > https://github.com/Yelp/dumb-init/issues/51#issuecomment-227792216 -- This message was sent by Atlassian JIRA (v7.6.3#76005)