SmsStorageException in SmsMessage::setResult() causes repeated dispatch of duplicate messages after failed queue

Created on 9 September 2017, about 7 years ago
Updated 31 May 2023, over 1 year ago

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.

🐛 Bug report
Status

Active

Version

1.0

Component

Core Framework

Created by

🇳🇬Nigeria almaudoh

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024