From c43fdfe32b52e2c770cb2f74c367361562cf04ec Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Wed, 30 Apr 2014 12:25:52 +0200 Subject: [PATCH] [FIX] mail: avoid catching (transient) MemoryErrors when sending outgoing mail This would permanently mark the mail as failed while there is a good chance it will be sent properly next time it is retried (provided the memory situation improves or the server/worker has restarted). bzr revid: odo@openerp.com-20140430102552-qkwv20b20nve64th --- addons/mail/mail_mail.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/mail/mail_mail.py b/addons/mail/mail_mail.py index d49c84b..b558f47 100644 --- a/addons/mail/mail_mail.py +++ b/addons/mail/mail_mail.py @@ -319,6 +319,10 @@ class mail_mail(osv.Model): # see revid:odo@openerp.com-20120622152536-42b2s28lvdv3odyr in 6.1 if mail_sent: self._postprocess_sent_message(cr, uid, mail, context=context) + except MemoryError: + # prevent catching transient MemoryErrors, bubble up to notify user or abort cron job + # instead of marking the mail as failed + raise except Exception: _logger.exception('failed sending mail.mail %s', mail.id) mail.write({'state': 'exception'}) -- 1.7.10.4