Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Race condition when receiving multiple emails for the same feed #6

Closed
atduarte opened this issue Feb 5, 2019 · 2 comments
Closed

Comments

@atduarte
Copy link

atduarte commented Feb 5, 2019

Symptoms:
Created a kill-the-newsletter.com feed that every 24h receives 5 new emails. Multiple successfully sent emails never show up in the feed.

Possible explanation:
Every time a email arrives exim creates a new Rails runner. (https://github.com/leafac/kill-the-newsletter/blob/master/config/exim/exim.production.example.conf#L29)

This runner reads a file, modifies it and then rewrites it. (https://github.com/leafac/kill-the-newsletter/blob/97cbc83c589033197370ceecb850c587d0399d4a/app/mailers/inbox_mailer.rb#L29)

If two or more emails arrive (more or less) at the same time we have a race condition that may results in not persisting all but one email.

@leafac
Copy link
Owner

leafac commented Feb 5, 2019

Unfortunately Kill the Newsletter! dropped some messages between yesterday and today, which may explain why you don’t see all the emails in your feeds. But the problem should be fixed now.

In any case, you’re right that a race condition may occur, but it should be pretty rare because delivery is very fast. Please let me know if you continue to see problems, in which case I may install some sort of lock or serialize the delivery with Exim’s configuration max_parallel = 1.

@leafac leafac closed this as completed Feb 5, 2019
@leafac
Copy link
Owner

leafac commented Jun 24, 2019

After running Kill the Newsletter! for many years, I finally observed one case of a race condition. I fixed the affected feed manually and fixed the race condition for good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants