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

Don't pass task-related arguments to mesos-executor

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.20.1
    • 0.21.0
    • agent
    • None
    • Linux 3.13.0-35-generic x86_64 Ubuntu-Precise

    Description

      TL;DR: When a command executor is used with shell=false and an array of arguments, those same arguments are directly passed to mesos-executor which fails miserably.

      Attempting to launch a task using the command executor with shell=false and passing arguments fails strangely.

      CommandInfo proto
      command {
        value: "/my_program"
        user: "app"
        shell: false
        arguments: "my_program"
        arguments: "--start"
        arguments: "2014-10-06"
        arguments: "--end"
        arguments: "2014-10-07"
      }
      

      Dies with:

      stderr
      Failed to load unknown flag 'end'
      Usage: my_program [...]
      
      Supported options:
        --[no-]help         Prints this help message (default: false)
        --[no-]override     Whether or not to override the command the executor should run
                            when the task is launched. Only this flag is expected to be on
                            the command line and all arguments after the flag will be used as
                            the subsequent 'argv' to be used with 'execvp' (default: false)
      

      This is coming from a failed attempt to have the slave launch mesos-executor. This is due to an adverse interaction between new CommandInfo features and this blurb from src/slave/slave.cpp:

          // Copy the CommandInfo to get the URIs and environment, but
          // update it to invoke 'mesos-executor' (unless we couldn't
          // resolve 'mesos-executor' via 'realpath', in which case just
          // echo the error and exit).
          executor.mutable_command()->MergeFrom(task.command());
      
          Result<string> path = os::realpath(
              path::join(flags.launcher_dir, "mesos-executor"));
      
          if (path.isSome()) {
            executor.mutable_command()->set_value(path.get());
          } else {
            executor.mutable_command()->set_value(
                "echo '" +
                (path.isError()
                 ? path.error()
                 : "No such file or directory") +
                "'; exit 1");
          }
      

      This is failing to:

      • clear the arguments field
      • probably explicitly restore shell=true
      • clear container ?
      • clear user ?

      I was able to quickly fix this locally by making a man-in-the-middle program at /usr/local/libexec/mesos/mesos-executor that stripped all args before exec-ing the real mesos-executor binary.

      Attachments

        Activity

          People

            Unassigned Unassigned
            naelyn Deleted User
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: