[
https://issues.apache.org/jira/browse/MESOS-8978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16502500#comment-16502500
]
Kevin Klues commented on MESOS-8978:
------------------------------------
We discussed on slack and confirmed there is a similar issue with the DC/OS CLI.
{{msh}} is more like a launch-then-attach, than an {{exec}}.
Running the equivalent in the {{dcos}} CLI, we see:
{noformat}
Launch marathon app:
{
"id": "/bash-forever",
"cmd": "/bin/sh -i",
"cpus": 0.1,
"disk": 0,
"instances": 1,
"mem": 128,
"tty": true
}
Run attach and print stdout:
$ dcos task attach bash-forever
sh-4.3# cat stdout
Executing pre-exec command
'{"arguments":["mesos-containerizer","mount","--help=false","--operation=make-rslave","--path=\/"],"shell":false,"value":"\/opt\/mesosphere\/active\/mesos\/libexec\/mesos\/mesos-containerizer"}'
Executing pre-exec command '{"shell":true,"value":"mount -n -t proc proc \/proc
-o nosuid,noexec,nodev"}'
Executing pre-exec command
'{"arguments":["mount","-n","-t","ramfs","ramfs","\/var\/lib\/mesos\/slave\/slaves\/7afdd628-3cfb-44f8-b6dc-dbe3ba18901e-S4\/frameworks\/7afdd628-3cfb-44f8-b6dc-dbe3ba18901e-0001\/executors\/bash-forever.76230e3e-6902-11e8-b489-1a42a410974d\/runs\/056fda1e-e8d1-4f96-ae3d-d5fdc902b908\/.secret-c5c4bf09-d6a5-419c-8c8f-103c601d7480"],"shell":false,"value":"mount"}'
WARNING: Logging before InitGoogleLogging() is written to STDERR
W0605 20:53:13.284710 5 openssl.cpp:476] Failed SSL connections will be
downgraded to a non-SSL socket
I0605 20:53:13.284783 5 openssl.cpp:498] CA directory path unspecified!
NOTE: Set CA directory path with LIBPROCESS_SSL_CA_DIR=<dirpath>
I0605 20:53:13.284796 5 openssl.cpp:503] Will not verify peer certificate!
NOTE: Set LIBPROCESS_SSL_VERIFY_CERT=1 to enable peer certificate verification
I0605 20:53:13.284811 5 openssl.cpp:509] Will only verify peer certificate
if presented!
NOTE: Set LIBPROCESS_SSL_REQUIRE_CERT=1 to require peer certificate verification
W0605 20:53:13.285053 5 process.cpp:1197] Failed SSL connections will be
downgraded to a non-SSL socket
I0605 20:53:13.289585 5 exec.cpp:162] Version: 1.4.2
I0605 20:53:13.300499 9 exec.cpp:236] Executor registered on agent
7afdd628-3cfb-44f8-b6dc-dbe3ba18901e-S4
I0605 20:53:13.301709 13 executor.cpp:171] Received SUBSCRIBED event
I0605 20:53:13.301956 13 executor.cpp:175] Subscribed executor on 10.0.0.71
I0605 20:53:13.302038 13 executor.cpp:171] Received LAUNCH event
I0605 20:53:13.302227 13 executor.cpp:633] Starting task
bash-forever.76230e3e-6902-11e8-b489-1a42a410974d
I0605 20:53:13.302866 13 executor.cpp:477] Running
'/opt/mesosphere/active/mesos/libexec/mesos/mesos-containerizer launch
<POSSIBLY-SENSITIVE-DATA>'
I0605 20:53:13.303722 13 executor.cpp:646] Forked command at 15
sh: cannot set terminal process group (-1): Inappropriate ioctl for device
sh: no job control in this shell
{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
> 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)