symfony-messenger
symfony-messenger copied to clipboard
PartialBatchFailure issue
Hello !
We had few weird issues since we enabled partialBatchFailure.
The main idea is we had some messages that were handled successfully by Symfony BUT requeue in SQS.
The missing clue I found this morning, it happens only when we have another failure in the batch.
So partialbatchFailure become my first target and I just find those lines :
https://github.com/brefphp/symfony-messenger/blob/854efa7d4815a331bd849436f9fa81d3f8927944/src/Service/Sqs/SqsConsumer.php#L63-L65
I totally understand why we want to markAsFailed to preserve message order BUT why do we want to handle them when we're going to requeue them by marking them as failed ?
In our situation it leads to some software issue because the batch got 2 events that mutate the same data. So the last win, and as the whole events were marked as failed, the 1st failed at the second run to mutate again because the 2nd did also its job.
Is there anything I miss @t-richard ?
I can totally help with the patch of course but I want to be sure we are ok on the solution ^^
In my mind a simple
if ($isFifoQueue && $hasPreviousMessageFailed) {
$this->markAsFailed($record);
continue;
}
It would make the job first.
Tthen we could also work with message attributes to skip only message with same messageGroupId that failed ones ?
Yes you're right, there seems to be a missing continue in the if statement. We don't want to process the following messages.
Can you provide a fix ?