You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mesos.apache.org by "Vinod Kone (JIRA)" <ji...@apache.org> on 2013/07/19 08:46:49 UTC

[jira] [Commented] (MESOS-380) Command Executor doesn't send TASK_KILLED for killed tasks.

    [ https://issues.apache.org/jira/browse/MESOS-380?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13713379#comment-13713379 ] 

Vinod Kone commented on MESOS-380:
----------------------------------

https://reviews.apache.org/r/12756/
                
> Command Executor doesn't send TASK_KILLED for killed tasks.
> -----------------------------------------------------------
>
>                 Key: MESOS-380
>                 URL: https://issues.apache.org/jira/browse/MESOS-380
>             Project: Mesos
>          Issue Type: Bug
>            Reporter: Benjamin Mahler
>            Assignee: Vinod Kone
>
> Currently the command executor will send either TASK_FAILED or TASK_FINISHED as a result of a killTask.
> The fix is non-trivial since it requires sharing some state with the waiter thread:
> static void waiter(pid_t pid, const TaskID& taskId, ExecutorDriver* driver)
> {
>   int status;
>   while (wait(&status) != pid || WIFSTOPPED(status));
>   CHECK(WIFEXITED(status) || WIFSIGNALED(status));
>   std::cout << "Waited on process " << pid
>             << ", returned status " << status << std::endl;
>   TaskStatus taskStatus;
>   taskStatus.mutable_task_id()->MergeFrom(taskId);
>   // THIS BIT NEEDS TO KNOW WHETHER THE TASK WAS KILLED!
>   if (WIFEXITED(status) && WEXITSTATUS(status) == 0) {
>     taskStatus.set_state(TASK_FINISHED);
>   } else {
>     taskStatus.set_state(TASK_FAILED);
>   }
>   Try<string> message = WIFEXITED(status)
>     ? strings::format("Command exited with status %d", WEXITSTATUS(status))
>     : strings::format("Command terminated with signal '%s'",
>                       strsignal(WTERMSIG(status)));
>   if (message.isSome()) {
>     taskStatus.set_message(message.get());
>   }
>   driver->sendStatusUpdate(taskStatus);
>   // A hack for now ... but we need to wait until for the status
>   // update to get sent to the slave before we shut ourselves down.
>   sleep(1);
>   driver->stop();
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira