[5.0] [trunk] ir.cron and its implementation use a busywait timer that consumes unnecessary resources

Bug #640493 reported by Olivier Dony (Odoo)
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Status tracked in Trunk
5.0
Fix Released
Undecided
Unassigned
Trunk
Fix Released
Low
Unassigned

Bug Description

ir.cron is a netsvc.Agent and the setAlarm() method used to schedule tasks is implemented using python's threading.Timer which ultimately relies on a threading.Condition.
The issue is that threading.Condition's wait method is implemented with a busywait algorithm that consumes small amounts of system resources every second even if the task is scheduled to execute several days later.

This becomes a problem when a lot of Agent tasks (e.g. ir.cron tasks) are scheduled, because that creates as many threading.Condition as there are tasks, and the system resources can become impacted by the sum of all the little amounts of memory and CPU consumed.

This could become an important issue on large multi-tenant deployments...

An implementation based on real sleep() calls should be considered to avoid this.

Tags: 5.0 trunk

Related branches

Revision history for this message
Christophe Simonis (OpenERP) (kangol) wrote :

Branch merged at 2123 <email address hidden> and forwardported at 2746 <email address hidden>

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Fixed by Christophe(OpenERP).
Thanks.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.