Repository navigation
[BUG]: supertask not respecting max agents #2497
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't workingserverHashtopolis API/Server relatedHashtopolis API/Server related
Description
Activity
- addedbugSomething isn't workingSomething isn't workingserverHashtopolis API/Server relatedHashtopolis API/Server related
on Sep 16, 2026 I think this should pretty much solved the issue:
+++ b/src/inc/utils/TaskUtils.class.php @@ -1387,6 +1387,34 @@ class TaskUtils { public static function isSaturatedByOtherAgents($task, $agent) { $numAssignments = self::numberOfOtherAssignedAgents($task, $agent); return ($task->getIsSmall() == 1 && $numAssignments > 0) || // at least one agent is already assigned here - ($task->getMaxAgents() > 0 && $numAssignments >= $task->getMaxAgents()); // at least maxAgents agents are already assigned + ($task->getMaxAgents() > 0 && $numAssignments >= $task->getMaxAgents()) || // at least maxAgents agents are already assigned + self::isWrapperSaturatedByOtherAgents($task, $agent); // the TaskWrapper of this task is full + } + + /** + * Check if the TaskWrapper has enough agents - apart from the given + * + * Without this check the wrapper limit is only applied in getCandidateTasks(). Thus agents who were already running, are never released. An agent who was already assigned never passes which is already assigned never passes there + * + * @param Task $task + * @param Agent $agent + * @return boolean true if maxAgents != 0 and number of assigned agents >= maxAgents, false otherwise + */ + public static function isWrapperSaturatedByOtherAgents($task, $agent) { + $taskWrapper = Factory::getTaskWrapperFactory()->get($task->getTaskWrapperId()); + if ($taskWrapper == null || $taskWrapper->getMaxAgents() <= 0) { + return false; // no wrapper limit configured + } + $qF = new QueryFilter(Task::TASK_WRAPPER_ID, $taskWrapper->getId(), "="); + $tasks = Factory::getTaskFactory()->filter([Factory::FILTER => $qF]); + $numAssignments = 0; + foreach ($tasks as $wrapperTask) { + $numAssignments += self::numberOfOtherAssignedAgents($wrapperTask, $agent); + } + return $numAssignments >= $taskWrapper->getMaxAgents();
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingserverHashtopolis API/Server relatedHashtopolis API/Server related
Type
Projects
- StatusShow more project fieldsTodo
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:
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:
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