Incoming emails no longer processed, log showing Email can not be processed: Email::Receiver::EmptyEmailError

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

?

1 Like

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)

2 Likes

And if that fixes it, then this should be moved to bug.

2 Likes

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!

2 Likes

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.

1 Like