- changed status to resolved
Mailing list emails could be processed twice
Issue #140
resolved
The implementation of process_mailinglist_queue
in cron/process_mailinglist_queue.php
doesn’t check the mailinglist status again once it starts processing.
This could lead to this scenario:
- Two mails to are queued between two consecutive cron job runs so they will be processed by the same job. The first is send to a big list (that takes longer than 5 minutes to process), the second can be send to any list.
- A first run of the job queries all “waiting” emails, which in this case is both. It starts processing the first mail, which is marked as with the status “processing”.
- 5 minutes later, a second run starts. It queries all “waiting” emails, which in this case is only the second email. It starts processing and marks the mail as such.
- When the first job is done processing the first mail, it will start processing the second mail. As it doesn’t check status, it will process it regardless of what the second run has done with the email. (It might even be send, but to the first job it’s status is still ‘waiting’).
- The first job will now also process the second email, so it is send twice.
This is a problem (obviously). Before processing an email, it should be verified with the DB that the mail is still waiting to be processed.
Comments (1)
-
reporter - Log in to comment
Mitigate race conditions in mailinglist queue handler. Fixes
#140→ <<cset 0eb2fd01810c>>