Closed Bug 715806 Opened 13 years ago Closed 12 years ago

Emails can get stuck in TheSchwartz's queue because Email::Send::Sendmail doesn't deal with sendmail errors correctly

Categories

(Bugzilla :: Email Notifications, defect)

4.0.3
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 4.4

People

(Reporter: glob, Assigned: glob)

Details

Attachments

(1 file, 1 obsolete file)

Email::Send::Sendmail treats all sendmail errors as transient, which results in mail jobs being "stuck" in the ts_job table.

for example:

| There was an error sending mail from 'bugzilla-daemon@mozilla.org' to 'someone@example..com': error when closing pipe to /usr/lib/sendmail: |

in this case sendmail will have set the exit status to EX_HOST (host name unknown), which should be treated as a fatal error.

unfortunately there's no mechanism to signal to bugzilla that this message failed, and it should be removed -- currently all failures are treating as transient, and will always result in a retry.  so we'll have to tell bugzilla that the job was successful in order for it to remove it from the queue.  this isn't a massive problem, as there isn't anything in bugzilla which alerts admins of these failures anyhow.

Email::Send is deprecated project, so we won't be getting a fix into Email::Send::Sendmail.  however it would be pretty simple to write our own sendmail handler for Email::Send which identifies fatal errors from sendmail and returns success.
Attached patch patch v1 (obsolete) — Splinter Review
i'm not even sure i like this solution, but short of a major overhaul i can't see a simpler way.
Assignee: email-notifications → glob
Status: NEW → ASSIGNED
Attachment #586359 - Flags: review?(LpSolit)
Comment on attachment 586359 [details] [diff] [review]
patch v1

>=== added file 'Bugzilla/Send/Sendmail.pm'

>+package Bugzilla::Send::Sendmail;

Move this line after the license block.


>+
>+# ***** BEGIN LICENSE BLOCK *****
>+# Version: MPL 1.1

Use MPL 2.0, see bug 680131 comment 22 for the exact license header to use with the Bugzilla project.


>+use File::Spec();
>+use Return::Value;
>+use Symbol qw(gensym);

We are sure these modules are available, right?


I'm really not the right reviewer for this patch. First because I never used JobQueue and I don't have the required modules to test it, and second because I don't use Sendmail. Redirecting to dkl, assuming he is a better reviewer than me about sendmail + jobqueue.
Attachment #586359 - Flags: review?(LpSolit) → review?(dkl)
Comment on attachment 586359 [details] [diff] [review]
patch v1

Review of attachment 586359 [details] [diff] [review]:
-----------------------------------------------------------------

::: Bugzilla/Send/Sendmail.pm
@@ +1,1 @@
> +package Bugzilla::Send::Sendmail;

Could you subclass Email::Send::Sendmail instead of copying all its code?
Attached patch patch v2Splinter Review
> Use MPL 2.0, see bug 680131 comment 22 for the exact license header to use
> with the Bugzilla project.

done

> >+use File::Spec();
> >+use Return::Value;
> >+use Symbol qw(gensym);
> 
> We are sure these modules are available, right?

yes, they are required by Email::Send

> Could you subclass Email::Send::Sendmail instead of copying all its code?

done
Attachment #586359 - Attachment is obsolete: true
Attachment #586359 - Flags: review?(dkl)
Attachment #586902 - Flags: review?(dkl)
Comment on attachment 586902 [details] [diff] [review]
patch v2

Review of attachment 586902 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good to me and works as expected. I was not able to recreate every exit code individually but they look correct to me
based on sysexits.h. r=dkl
Attachment #586902 - Flags: review?(dkl) → review+
Flags: approval?
Flags: approval? → approval+
Target Milestone: --- → Bugzilla 4.4
Committing to: bzr+ssh://bjones%40mozilla.com@bzr.mozilla.org/bugzilla/trunk/
modified Bugzilla/Mailer.pm
added Bugzilla/Send
added Bugzilla/Send/Sendmail.pm
Committed revision 8099.
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: