Project

General

Profile

Actions

Defect #28874

closed

MailHandler does not log exceptions caught

Added by Olivier Houdas almost 6 years ago. Updated about 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Email receiving
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Duplicate
Affected version:

Description

Issue:
If a locally unhandled exception is raised when receiving a mail, the error is not logged.

How to repro:
1. Add the line

raise "An error occurred" 

as the first line of the receive method
2. Run the rake task
rake redmine:email:receive_imap RAILS_ENV="production" host=imap.gmail.com port=993 move_on_success=Success move_on_failure=Failure username=***** password=*****

on a mailbox which has at least one unread mail in the mailbox
3. Check the redmine log
Result:
D, [2018-05-24T17:25:53.647960 #16786] DEBUG -- : Receiving message 21674
D, [2018-05-24T17:25:53.648109 #16786] DEBUG -- : Message 21674 can not be processed

Expected result:
D, [2018-05-24T17:25:53.647960 #16786] DEBUG -- : Receiving message 21674
E, [2018-05-24T17:25:53.648076 #16786] ERROR -- : MailHandler: an unexpected error occurred when receiving email: An error has occured
D, [2018-05-24T17:25:53.648109 #16786] DEBUG -- : Message 21674 can not be processed

Suggested fix: define logger as self.logger instead as just logger in the MailHandler class


Related issues

Is duplicate of Redmine - Defect #30457: MailHandler.safe_receive does not output any error logClosedGo MAEDA

Actions
Actions #1

Updated by Go MAEDA over 5 years ago

  • Target version set to Candidate for next minor release
Actions #2

Updated by Yuichi HARADA over 5 years ago

In my environment, it works normally.
With Gmail IMAP enabled, we did the following steps.

1. Insert raise "An error occurred" in source:trunk/app/models/mail_handler.rb#L28.
2. Run the rake task.(rake redmine:email:receive_imap RAILS_ENV=development)
3. Check the log/development.log

Receiving message 16
MailHandler: an unexpected error occurred when receiving email: An error occurred
Message 16 can not be processed

Actions #3

Updated by Go MAEDA over 5 years ago

  • Status changed from New to Needs feedback
  • Target version deleted (Candidate for next minor release)
Actions #4

Updated by Go MAEDA about 5 years ago

  • Status changed from Needs feedback to Closed
  • Resolution set to Duplicate

I confirmed this issue and posted a patch. Please see #30457 for details. Thank you for reporting this issue.

Actions #5

Updated by Go MAEDA about 5 years ago

  • Is duplicate of Defect #30457: MailHandler.safe_receive does not output any error log added
Actions #6

Updated by Olivier Houdas about 5 years ago

Thanks a million for fixing that issue! I'm really sorry I didn't have any time to work on Redmine in the last 6 months, but we're still using it in the company.

Actions

Also available in: Atom PDF