[ZCM] [ZC] 2319/16 Comment "MailHost sends duplicate emails on zodb conflicts"
"Collector: Zope Bugs, Features, and Patches ..." <[email protected]> Sat, 18 Aug 2007 14:05:11 -0400
| Newsgroups | gmane.comp.web.zope.devel.collector-monitor |
|---|---|
| Message-ID | <[email protected]> |
Issue #2319 Update (Comment) "MailHost sends duplicate emails on zodb conflicts"
Status Pending, Zope/bug medium
To followup, visit:
http://www.zope.org/Collectors/Zope/2319
==============================================================
= Comment - Entry #16 by ajung on Aug 18, 2007 2:05 pm
Here is TransactionalMailHost (on top of zope.sendmail):
http://svn.zope.org/Products.TransactionalMailHost/trunk/
It does not provide (and won't) full API compatibility but should work with most existing apps.
________________________________________
= Comment - Entry #15 by ajung on Aug 14, 2007 12:46 am
I will definitely work on something on top of zope.sendmail for Zope 2.12 - not sure if it will be an additional Mailhost or a replacement.
________________________________________
= Resubmit - Entry #14 by tseaver on Aug 13, 2007 10:02 am
Status: Rejected => Pending
Bad rejection: there isn't any consensus that such a rewrite
belongs in the core, while the patch is for something which
must remain in the core for BBB.
People who want a more-robust-but-harder-to-configure MailHost
replacement already have several 3rd party products to choose from.
________________________________________
= Reject - Entry #13 by ajung on Aug 12, 2007 1:07 am
Status: Pending => Rejected
Rejecting this patch since Mailhost should reimplemented or replaced with a wrapper around zope.sendmail...
________________________________________
= Comment - Entry #12 by marc_mengel on May 3, 2007 11:56 am
Uploaded: "mail.patch.notabs"
- http://www.zope.org/Collectors/Zope/2319/mail.patch.notabs/view
Here's the patch again, without the tabs...
________________________________________
= Comment - Entry #11 by marc_mengel on May 3, 2007 11:42 am
Regarding test cases... There are issues with a test case for his problem:
1) the current test suite doesn't actually send any mail, which leaves open the question of whether and/or to where a test case should send mail...
2) I'm not really sure how to make a test case run two threads to get a ConflictError/retry.
3) the test case cannot check the outgoing email to see if more than one got sent, at least not easily.
I could give a Script(python) and a bash script that does parallel wget calls that reproduces it/shows the fix, where a person could input their email into the bash script...
________________________________________
= Comment - Entry #10 by ajung on May 2, 2007 5:42 am
I would not object to replace it with zope.sendmail. The only
official documented API method of Mailhost is send(). There is also simple_send() and sendTemplate(). Remaining backward compatible for these methods would be fine but I would not care much if not.
________________________________________
= Comment - Entry #9 by philikon on May 2, 2007 5:33 am
I should note that the zope.sendmail package already provides transactional email sending functionality (with two different implementations, one that keeps the emails in memory, one that writes them to a Maildir). Why not simply make MailHost use that?
I'll also note that zope.sendmail's error handling could be improved in case it's not able to send emails due to malformed addresses, unavailable SMTP server, etc. I can assume that the standard MailHost could also be improved in this regard, hence my suggestion to make it a wrapper around zope.sendmail so it can take advantange of future improvements there.
________________________________________
= Comment - Entry #8 by ajung on May 2, 2007 5:25 am
MDH requires an external daemon which is not suitable for an out-of-the-box
installation of Zope. In addition I have no idea how one would use the daemon on Windows...sorry, but MDH as default would cause too much unnecessary trouble.
Sending mail through the commit would help to avoid MDH for most people. People
with a large mail volumne per transaction can still use MDH.
________________________________________
= Comment - Entry #7 by chrisw on May 2, 2007 5:14 am
To be honest, this patch seems a little slap dash.
I'd prefer to see MDH become part of "core" Zope and "normal" MailHost deprecated.
That said, with the "smaller packages" distribution thingy that most people are doing with eggs now would suggest we should just deprecate MailHost and recommend people use MDH...
________________________________________
= Comment - Entry #6 by ajung on May 2, 2007 1:07 am
"for most users" = you only send a minor number of mails out of Zope. If you have to send to lot of emails (for newsletters etc).
MDH is still the choice. Installing MDH for low-level mail situations would be overkill and a zero-configuration solution for the problem would be of advantage for most users.
________________________________________
= Comment - Entry #5 by jens on May 2, 2007 12:49 am
It does not make MaildropHost obsolete at all. You're overlooking the asynchronous mail delivery, which is its main purpose. The transaction awareness was just a secondary feature.
________________________________________
= Comment - Entry #4 by ajung on May 2, 2007 12:35 am
+1 for accepting such a patch for Zope 2.11 since it makes
MailDropHost obsolete for most users (sorry Jens :-)) sending out a number of mails from time to time.
________________________________________
= Comment - Entry #3 by ajung on May 2, 2007 12:35 am
+1 for accepting such a patch for Zope 2.11 since it makes
MailDropHost obsolete for most users (sorry Jens :-)) sending out a number of mails from time to time.
________________________________________
= Comment - Entry #2 by tseaver on May 2, 2007 12:27 am
Thanks for the patch. A couple of issues:
- The whitespace in the patch is messed up -- please normalize,
removing any tab characters.
- This kind of change really needs unit tests; can you
please supply some?
________________________________________
= Request - Entry #1 by marc_mengel on May 1, 2007 7:53 pm
Uploaded: "mail.patch"
- http://www.zope.org/Collectors/Zope/2319/mail.patch/view
If you have a script or action that sends email and does other work, that gets a ZODB conflict error, the mail gets sent a second (or third!) time as the conflict resolution runs again. We noticed this in particular with AlphaFlow where several workflow items were occurring in a row, but it can happen any time you have a script that sends email and updates a ZODB object.
A resource manager for sending email solves this problem.
==============================================================