You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mesos.apache.org by "Benjamin Mahler (JIRA)" <ji...@apache.org> on 2013/03/07 01:28:12 UTC
[jira] [Created] (MESOS-380) Command Executor doesn't send
TASK_KILLED for killed tasks.
Benjamin Mahler created MESOS-380:
-------------------------------------
Summary: 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
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