← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 715418] Re: [5.x] ir.cron - simultaneous start of cron jobs

 

The attached file can be used to replace addons/base/ir/ir_cron.py (with
V5; read inline comments for changes to V6).

This file solves the problems discussed (and more):
 - jobs are concurrent
 - jobs start precisely at their "Next execution date" and obey their "Interval"
 - duplicate start of jobs is inhibited
 - does not wait for pending jobs during openerp-server restart
 - jobs get terminated at openerp-server shutdown
 - vastely improved logging-information (e.g. CPU-time, elapsed-time)
 - removed usage of old python modules

A function "thread_watchdog" can be used as health monitor for threads:
Simply schedule a job with Object "ir_cron" and Function "thread_watchdog" (no arguments).
Threading anomalies are written to the server-log.

** Attachment added: "ir_cron.py"
   https://bugs.launchpad.net/openobject-server/+bug/715418/+attachment/1895620/+files/ir_cron.py

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/715418

Title:
  [5.x] ir.cron - simultaneous start of  cron jobs

Status in OpenERP Server:
  Triaged

Bug description:
  We have not checked if this is fixed in v6

  Batch-jobs defined via ir_cron may be started simultaneously/concurrently.
  (We have seen up to 17 identical executions of the same job)

  /base/ir/ir_cron.py starts timer (via netsvc.startTimer) without 
  checking, whether there is already a timer started for the same point in 
  time (or: without removing such simultaneous timers).
  Hence, ir_cron._poolJobs will be invoked several times simultaneously.

  I suggest to maintain a list of timers in /base/ir/ir_cron.py which 
  inhibits duplicate timers.
  Alternatively "duplicate" timers could be removed - although this might 
  be difficult to implement.
  Such a mechanism could also be implemented within netsvc.startTimer - on 
  the other hand: simultaneous jobs can also be useful (outside ir_cron).

  When are jobs "simultaneous"?
  I suggest to implement a "time-granularity" which is less or equal the 
  smallest granularity of ir_cron-Jobs, i.e. "minutes".
  To be on the safe side for long-running jobs, the time-granularity may 
  also be the shortest interval currently defined via ir_cron (e.g. 10 
  minutes).

  any ideas ?



References