[Zope-dev] zope.sendmail RFC: start background thread on ProcessStarting event

Marius Gedminas marius at gedmin.as
Thu Jan 28 09:56:19 EST 2010


zope.sendmail has this nasty habit of starting a background thread
during ZCML conguration, if your ZCML contains a <queuedDelivery>
directive.  This is Very Bad(TM) if you use things like debugzope, since
you end up with two processes watching your mail queue, which can easily
result in duplicate emails getting sent.

Fabio Tranchitella recently released zope.sendmail 3.8.0 which fixes the
problem in the following way:

  * you edit <queuedDelivery> and set processorThread="false" to
    suppress that thread

  * you edit your init.d scripts and start a new daemon (zope-sendmail)
    to watch the queue

I recently came up with a different and perhaps a bit simpler solution:

  * make zope.sendmail not start the thread during ZCML processing,
    instead make it listen for ProcessStarting events and start the
    thread then.

It would have the following advantages:

  * it would make the _default_ configuration of zope.sendmail (which
    is processorThread=true for BBB reasons) not quite as broken as it
    is now

  * simpler administration: no need to figure out what new daemon you
    need to start and how to do that.

  * it could be backported to older zope.sendmail bugfix releases (e.g.
    3.5.2).

and the following disadvantages:

  * it's a kinda redundant solution for the same problem

  * ProcessStarting is not necessarily emitted on Zope startup, e.g. I
    think it's not used if you deploy a Zope-3-based WSGI app

What do other people think?

Marius Gedminas
-- 
http://pov.lt/ -- Zope 3 consulting and development
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/zope-dev/attachments/20100128/9ab2bd30/attachment.bin 


More information about the Zope-Dev mailing list