Uploaded image for project: 'Mesos'
  1. Mesos
  2. MESOS-8978

Command executor calling setsid breaks the tty support.

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.4.1, 1.5.1, 1.6.0, 1.7.0
    • Fix Version/s: 1.5.2, 1.6.2, 1.7.1, 1.8.0
    • Component/s: None
    • Labels:
      None

      Description

      I was playing with msh (one example from 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 using the agent operator API.

      However, I got the following error when doing the following:

      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
      

      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). Looks like we did an extra `setsid` 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

        Attachments

          Activity

            People

            • Assignee:
              klueska Kevin Klues
              Reporter:
              jieyu Jie Yu
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: