Attached is a diff of the code that I changed in MailManager.py
< = new file
> = old file
The basic idea is that I added a try: except: block in process_task, so
that if there is an exception in the code between the getCronLock and
releaseCronLock calls, it will drop into the except and then call
It's been running for a couple hours without a problem, but our system
isn't used heavily.
If folks want to try it, let me know how it goes.
If you would like me to email you the patched file directly, just email
me and ask (I didn't want to proliferate a 188K file to all the MM
users. That would be naughty).
(401) 921-4530 fax
Kevin Campbell wrote:
> On Wed, Sep 27, 2006 at 09:18:09AM -0400, Matthew Caron wrote:
>>> The process_task method makes use of get_lock and release_lock under MySQL.
>>> Unfortunately, these are not transaction safe. It is possible that the
>>> getmail process failed, aborting the transaction, and leaving the lock open.
>>> As Zope does connection pooling with ZMySQLDA, this will hold the lock
>>> indefinitely, until that connection is reset.
>> That might explain why it starts working again when I restart zope.
>>> If you wanted to submit a patch for an alternative locking mechanism for
>>> MySQL 5, that would be appreciated. For now, if you raise a bug on sf it
>>> will be looked at, but I cannot see an immediate fix to this issue.
>> Why do the locking in the DB in the first place? Assuming that the
>> purpose of the lock is to be sure that two copies of the script don't
>> run, why not just create a lockfile somplace (/var? /tmp? something
>> configurable?) and use it via std. lockfile semantics?
> The main reason is that there is no guarantee there is one MailManager
> instance per database backend, or that they are on the same server.
>> Alternatively, you can just wrap the body of the script in a big
>> exception handler (assuming Python has such a thing) which starts just
>> after you get the lock and ends just before you release the lock. That
>> way, you can be assured that the lock will get released.
> That is certainly an option, and if there was a patch submitted with
> relevant details and updates to test cases, it should be included in the
> core product.
> Kevin Campbell
> Logicalware Ltd
> GPG Key: F480EC23
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys -- and earn cash
> Mailmanager-users mailing list