March 16, 2023, 9:31pm
My error-log is full of these messages:
Job exception: undefined method `is_bounce?’ for nil.
/var/www/discourse/lib/email/processor.rb:27:in `rescue in process!'
/var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:43:in `block (2 levels) in poll_pop3'
/var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:40:in `block in poll_pop3'
/var/www/discourse/app/jobs/base.rb:249:in `block (2 levels) in perform'
/var/www/discourse/app/jobs/base.rb:236:in `block in perform'
mini_scheduler-0.15.0/lib/mini_scheduler/manager.rb:59:in `block (2 levels) in ensure_worker_threads'
I’m wondering, how
@receiver could get nil in
@receiver = Email::Receiver.new(@mail, @opts)
Jobs.enqueue(:process_email, mail: @mail, source: @opts[:source])
rescue => e
return handle_bounce(e) if @receiver.is_bounce?
March 19, 2023, 5:36am
My current understanding is, that
mail=nil which raises an
rescue part expects an initialized
Email::Processor.initialize raise some Error when called with
March 20, 2023, 5:19am
My guess is that somehow
I think a PR that changes:
@receiver&.is_bounce? would be fine, at least the error would float into handle_bounce.
March 29, 2023, 8:20am
We’re seeing the same issue, see
Problems with email processing: undefined method `is_bounce?' for nil:NilClass - #2 by mekentosj. Is there any workaround, thing we can do to have email be processed again? Is this caused by a specific email or user?
Update: Ok, definitely confirmed that this is the problem. Thanks to @thoka’s analysis I now knew what to look for, the problem is indeed empty emails. Notice how the messages are unread exactly up to the point where an empty email appears?
Deleting it from the inbox makes the processing get unstuck again. That is, until it hit the next email that was blank:
So blank emails currently get the system stuck for us, at least beyond a certain number because it does seem to be a bit of a hit or miss whether it gets permanently stuck or not.
Guess we have to monitor things for now but would be great if this could be fixed indeed. Thanks!!