Description
Symfony version(s) affected
5.3.8
Description
When running Symfony on a 32bits system like a Raspberry PI 4 (ARMv7 = 32 bit) the retry mechanisme with a delay doesn't work. This is caused by reaching the PHP_INT_MAX limit when it does calculate the score for the new 'delayed' message.
vendor\symfony\redis-messenger\Transport\Connection.php:476
$score = (int) ($this->getCurrentTimeInMilliseconds() + $delayInMs);
var_dump($score);
$added = $this->connection->zadd($this->queue, ['NX'], $score, $message);
Result:
int(-685048788)
Expected is a very large positive integer, for example:
int(1635697524000)
Due to this bug a retried messages is never taken from the queue.
How to reproduce
Install Redis on a Raspberry 4 Model B
Install a Symony project with Messenger and Redis Messenger Transport.
Configure Redis for messenger.
Create a message handler that alway throws an exception.
Define a retry policy for failed messages with a delay of 60.000 ms.
Queue a message.
Start the message consumer with -vvv
option.
The message handling will failed, with a message like messenger.ERROR: Error thrown while handling message App\Message\YourMessage. Sending for retry #1 using 60000 ms delay.
The message will never be retried.
Possible Solution
- Add this limition to the documentation
- Make it possible to work with seconds instead of microseconds
- Substract all scores with 1000000000000 for example
Additional Context
No response