artem
September 13, 2024, 2:49pm
2
I don’t seem to have gotten an email. Not even in the Spam folder. I know you switched to a new system. I wonder if there’s a problem…
Oh dear, sorry about that! Can you send me a message with your email address so I can try to figure out what happened?
1 Like
It’s potentially related to this bug:
opened 06:30AM - 05 Jul 24 UTC
bug
**Version:**
- listmonk: [v3.0.0]
- OS: [Ubuntu LTS]
**Description of the… bug:**
We are encountering an issue where the campaign status is marked as "finished" before all emails have been sent.
**Campaign Details**
- Campaign Type: Email
- Subscriber List: Single opt-in list with 200,000 subscribers
- Blocklisted Subscribers: Approximately 20,000
- Batch Size: 200
- Issue Observed: Campaign status changed to "finished" after sending only 37 emails
**Analysis and Findings**
Upon further investigation, we identified a potential bug in the query/code that might be causing this issue. Below are the details (Code Snippet from Pipe.go):
``` go
// NextSubscribers processes the next batch of subscribers in a given campaign.
// It returns a bool indicating whether any subscribers were processed
// in the current batch or not. A false indicates that all subscribers
// have been processed, or that a campaign has been paused or cancelled.
```
**Campaign Scheduling Mechanism**
The campaign scheduling mechanism uses ```last_subscriber_id``` and ```max_subscriber_id``` to process subscribers
in batches. The ```last_subscriber_id``` acts as a pointer until ```max_subscriber_id``` is reached.
The ```subIDs``` query fetches distinct subscriber IDs and their subscription status from ```subscriber_lists``` where the list
ID is among the lists from ```campLists```. Additionally, it filters out subscribers with the status unsubscribed.
If all subscribers that meet the criteria in ```subIDs``` are ```blocklisted```, the subs CTE will return zero records due to the condition that excludes blocklisted subscribers.
**Observed Behaviour in Our Case**
In our scenario, during the second iteration, all 200 records were blocklisted, resulting in zero records being returned.
Consequently, the ```NextSubscribers``` process returned false, causing the campaign status to be changed to "finished" without sending emails to the entire list.
**Relevant Code in ```Pipe.go```**
```
// Line 85
if len(subs) == 0 {
return false, nil
}
```
**Conclusion**
The issue stems from the query filtering out blocklisted subscribers and returning zero records if all remaining subscribers in a batch are blocklisted. This causes the ```NextSubscribers``` process to return false prematurely, changing the campaign status to "finished".
**Recommendations**
To address this issue, we recommend modifying the query and/or logic to ensure that the campaign does not prematurely
finish when encountering batches of ```blocklisted``` subscribers. This will ensure that emails are sent to all eligible subscribers in the list.
However it may be related to some performance settings in listmonk. I’ve tweaked them and will see if this repeats again next week.
I really wish listmonk had some way to log out an email (or hash thereof) when it sends an email. That way I could at least confirm that I’m attempting to send it. Currently I’m just guessing in the dark.
2 Likes
artem
September 14, 2024, 2:54am
5
Cool, I got the email now, thank you! All the best with tuning the software!
1 Like