[FIX] server: avoid cron thread death
In case an exception (programming, out of memory or any other unexpected failure), the cron_thread would crash and not recover until server restart. Issue #15666 was an example of failure. Courtesy of Nils Hamerlinck
This commit is contained in:
parent
69e91f6a7c
commit
18fd9fe0a8
|
@ -262,8 +262,12 @@ class ThreadedServer(CommonServer):
|
||||||
_logger.debug('cron%d polling for jobs', number)
|
_logger.debug('cron%d polling for jobs', number)
|
||||||
for db_name, registry in registries.iteritems():
|
for db_name, registry in registries.iteritems():
|
||||||
while registry.ready:
|
while registry.ready:
|
||||||
acquired = openerp.addons.base.ir.ir_cron.ir_cron._acquire_job(db_name)
|
try:
|
||||||
if not acquired:
|
acquired = openerp.addons.base.ir.ir_cron.ir_cron._acquire_job(db_name)
|
||||||
|
if not acquired:
|
||||||
|
break
|
||||||
|
except Exception:
|
||||||
|
_logger.warning('cron%d encountered an Exception:', number, exc_info=True)
|
||||||
break
|
break
|
||||||
|
|
||||||
def cron_spawn(self):
|
def cron_spawn(self):
|
||||||
|
|
Loading…
Reference in New Issue