[ 
https://issues.apache.org/jira/browse/MESOS-1873?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

R.B. Boyer updated MESOS-1873:
------------------------------
    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.  

{noformat:title=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"
}
{noformat}

Dies with:

{noformat:title=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)
{noformat}

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}}:

{code}
    // 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");
    }
{code}

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.

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

{noformat:title=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"
}
{noformat}

Dies with:

{noformat:title=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)
{noformat}

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}}:

{code}
    // 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");
    }
{code}

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.


> Don't pass task-related arguments to mesos-executor
> ---------------------------------------------------
>
>                 Key: MESOS-1873
>                 URL: https://issues.apache.org/jira/browse/MESOS-1873
>             Project: Mesos
>          Issue Type: Bug
>          Components: slave
>    Affects Versions: 0.20.1
>         Environment: Linux 3.13.0-35-generic x86_64 Ubuntu-Precise
>            Reporter: R.B. Boyer
>         Attachments: mesos_executor_overshare.v2.diff
>
>
> *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.  
> {noformat:title=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"
> }
> {noformat}
> Dies with:
> {noformat:title=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)
> {noformat}
> 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}}:
> {code}
>     // 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");
>     }
> {code}
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to