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

Resource leak in slave.cpp.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.1.0
    • None
    • Mesosphere Sprint 42
    • 1

    Description

      Coverity detected the following resource leak:

      1. Condition this->queuedTasks.contains(taskId), taking true branch.
      6547  if (queuedTasks.contains(taskId)) {
          	2. Condition terminal, taking true branch.
      6548    if (terminal) {
          	3. alloc_fn: Storage is returned from allocation function operator new. [Note: The source code implementation of the function has been overridden by a builtin model.]
          	4. var_assign: Assigning: task = storage returned from new mesos::Task(mesos::internal::protobuf::createTask(this->queuedTasks.at(taskId), mesos::TaskState const(status->state()), this->frameworkId)).
      6549      Task* task = new Task(protobuf::createTask(
      6550          queuedTasks.at(taskId),
      6551          status.state(),
      6552          frameworkId));
      6553
      6554      queuedTasks.erase(taskId);
      6555
      6556      // This might be a queued task belonging to a task group.
      6557      // If so, we need to update the other tasks belonging to this task group.
      6558      Option<TaskGroupInfo> taskGroup = getQueuedTaskGroup(taskId);
      6559
          	5. Condition taskGroup.isSome(), taking true branch.
      6560      if (taskGroup.isSome()) {
          	6. No elements left in taskGroup->tasks(), leaving loop.
      6561        foreach (const TaskInfo& task_, taskGroup->tasks()) {
      6562          Task* task = new Task(
      6563              protobuf::createTask(task_, status.state(), frameworkId));
      6564
      6565          tasks.push_back(task);
      6566        }
          	7. Falling through to end of if statement.
      6567      } else {
      6568        tasks.push_back(task);
      6569      }
          	
      CID 1372871 (#1 of 1): Resource leak (RESOURCE_LEAK)
      8. leaked_storage: Variable task going out of scope leaks the storage it points to.
      6570    } else {
      6571      return Error("Cannot send non-terminal update for queued task");
      

      https://scan5.coverity.com/reports.htm#v39597/p10429/fileInstanceId=98881751&defectInstanceId=28450463

      Attachments

        Issue Links

          Activity

            People

              bbannier Benjamin Bannier
              js84 Jörg Schad
              Anand Mazumdar Anand Mazumdar
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: