Problem Statement:

A slight inconsistency has been exposed in SmsMessage::setResult() which results in a message being dispatched multiple times in some situations.
This is due to the fact that SmsMessage::setResult() throws an SmsStorageException('Saved SMS message results cannot be changed or updated.') exception if there is already a result.

So in a scenario where a queued message is dispatched, but for some reason, some other exception causes the QueueWorker\SmsProcessor to exit without cleaning up, the queued item would be saved and still left in the queue. On the next cron run, another attempt will be made to re-send this message. Sending will succeed (another copy of same message sent), but the $sms->setResult() line will throw the exception, the QueueWorker\SmsProcessor will exit again without cleanup and the $sms_message will still be left in the queue to be dispatched on the next cron run again....and on and on.

Resolution:

This needs to be discussed, but a possible check would be to confirm that the $sms_message hasn't previously been sent ($sms->getResult() === null) before attempting to send again.

Comments

almaudoh created an issue. See original summary.

Anas_maw’s picture

Priority: Normal » Critical

Facing the same problem, this is a critical issue.