Skip to content

[BUG]: supertask not respecting max agents #2497

Description

@jessevz

Version Information

1.0.1

Hashcat

7

Description

Sometimes it happens that a supertask with a max agents for example 10, more agents will jump on it. I suspect that the reason is, is that the function: isSaturatedByOtherAgents() will check how many agents are assigned to a task and compare that to the max agents of that single task. but it does not check if there are already too much agents working on the supertask. this only happens in the getChunk endpoint (when an agent is already assigned to a task), because here it is run like this:

        if (TaskUtils::isSaturatedByOtherAgents($task, $agent)) {

Only on the current assigned task, without checking the taskwrapper.

In the gettaskAction there is a wrapper in the form of getcanidatetasks, which will run this function for every task of a taskwrapper:

  private static function getCandidateTasks(Agent $agent, array $accessGroups, TaskWrapper $taskWrapper): array {
    $totalAssignments = 0;
    $candidateTasks = [];
    
    // load assigned tasks for this TaskWrapper
    $qF = new QueryFilter(Task::TASK_WRAPPER_ID, $taskWrapper->getId(), "=");
    $oF = new OrderFilter(Task::PRIORITY, "DESC");
    $tasks = Factory::getTaskFactory()->filter([Factory::FILTER => $qF, Factory::ORDER => $oF]);
    foreach ($tasks as $task) {
      // count number of other agents already working on the task,
      // no tasks can be candidates if limit is already reached
      $totalAssignments += self::numberOfOtherAssignedAgents($task, $agent);
      if ($taskWrapper->getMaxAgents() > 0 && $totalAssignments >= $taskWrapper->getMaxAgents()) {
        return [];
      }

where is called on every task numberOfOtherAssignedAgents

This is especially a problem since most of the times in a supertask, the max agents of a single sub task are set to zero, which makes the task claim every available agent on that priority

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingserverHashtopolis API/Server related

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions