דוא״ל נכנסים יותר לא מעובדים, בלוג מראה שהדוא״ל לא יכול להתבצע: Email::Receiver::EmptyEmailError

סיכום מבוסס בינה מלאכותית

User MKorndoerfer reported that Discourse stopped processing incoming emails, with logs showing Email::Receiver::EmptyEmailError and no entries in the rejected list. The issue persisted despite a small inbox (~30 emails) and the setting to delete processed emails being enabled as suggested. thoka speculated it might relate to timeouts or empty emails, and proposed patching processor.rb to skip blank mails or removing the failing Sidekiq job — cautioning to backup first. pfaffman noted that if the patch worked, it should be reported as a bug. MKorndoerfer later confirmed the mail server was experiencing issues, including read timeouts, and after consulting their host, identified a single problematic email as the root cause — moving it resolved processing for all other emails. MKorndoerfer offered to share the raw email privately for debugging. zogstrip requested the email for further investigation, highlighting its potential value for improving email handling in Discourse.

Suddenly the system stopped processing emails. In the log, I can see the following entry:

Message (7560 copies reported)

Email can not be processed: Email::Receiver::EmptyEmailError



Backtrace

/var/www/discourse/lib/email/processor.rb:183:in `log_email_process_failure'
/var/www/discourse/lib/email/processor.rb:29:in `rescue in process!'
/var/www/discourse/lib/email/processor.rb:16:in `process!'
/var/www/discourse/lib/email/processor.rb:13:in `process!'
/var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:29:in `process_popmail'
/var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:49:in `block (2 levels) in poll_pop3'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/net-pop-0.1.2/lib/net/pop.rb:669:in `each'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/net-pop-0.1.2/lib/net/pop.rb:669:in `each_mail'
/var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:46:in `block in poll_pop3'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/net-pop-0.1.2/lib/net/pop.rb:531:in `start'

I’ve checked the inbox and I can’t see any suspicious mail in there…

The error is not shown in the rejected list, as a matter of fact, nothing at all getting listed there anymore.

All the mails seems to remain in the inbox without being processed.

This happened to me once while polling mails via pop and getting into timeouts due to a huge inbox.

Do you delete received messages?

I haven’t, but there aren’t that many mails. Around 30.

And I actually need them to be processed…

Did you try

?

Yes, this setting has been enabled all along.

I think there’s sth wrong with the email provider. Strange things are happening…

Thanks for trying to help, if I’ll figure it out, I’ll let you know!

If I remember correct, I patched the code in the running discourse to ignore empty mails.

You could try to insert return if @mail.blank? before line 18.

Alternatively, you could try to remove the failing job from sidekiq.

(I would do a backup before such experiments)

And if that fixes it, then this should be moved to Contribute > Bug.

Just wait. It seems that the mail server is acting up. In addition to the empty mail error, I also get a read timeout, which I originally didn’t associate with the email process, but it is.

I’m currently talking with my mail hoster, who confirmed that there seems to be something wrong in his side.

As soon as I know more, I’ll let you know!

Ok, we found the culprit. It was a single mail, as soon as I moved that mail into a separate folder, the rest of the mails were processed correctly.

An IMAP client can see that mail just fine. I’d send that mail’s raw contents (incl. headers and all) in a private message, if you want, so you can check and debug the reason for hanging the process.

Any chances you’d still have that email lying around? Would love to have a pick at it (in a PM) if you do :+1: