[X] I have searched for a similar issue in our bug tracker and didn't find any solutions.
What happened?
There is the loop for handling the received task.
while ($task = $this->consumer->waitTask()) {
try {
$this->logger->debug('Processing task');
$this->eventHandler->handle($task->getPayload()); <----// HERE can be a logical error
/* @var ReceivedTaskInterface */
$task->complete();
} catch (Throwable $throwable) { <--- // CATCH this logical error here and try to attempt again, when
// attemps are over, our loop procceeds working like infitity mode,
// and
// we see in console the error bellow
$this->logger->warning('Got exception on job handling: ' . $throwable->getMessage(), $throwable->getTrace());
$retries = max(
(int) $task->getHeaderLine('attempts') - 1,
0
);
if (0 == $retries || !$this->shouldBeRestarted) {
try {
$task->fail($throwable, false);
} catch (Exception) {
$this->logger->alert($throwable->getMessage());
}
$this->logger->warning('Failed to complete task');
} else {
$this->logger->info('Restarting failed task, retries left: ' . $retries);
try {
/**
* @psalm-suppress ArgumentTypeCoercion
*/
$task->withHeader('attempts', (string) $retries)
->withDelay($this->resendDelaySeconds)
->fail($throwable, true);
} catch (Exception) {
$this->logger->alert($throwable->getMessage());
}
}
}
}
Version
v2.6.6
Relevant log output
{"level":"ERROR","ts":"2022-01-05T13:26:31.915Z","logger":"jobs ","msg":"job negatively acknowledged","error":"jobs_handle_response: protocol.errorResp.Headers: ReadMapCB: expect { or n, but found [, error found in #10 byte of ...|headers\":[]}|..., bigger context ...|in}\",\"requeue\":false,\"delay_seconds\":0,\"headers\":[]}|..."}
No duplicates 🥲.
What happened?
There is the loop for handling the received task.
Version
v2.6.6
Relevant log output