Fetchmail breaks cron transaction policy
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Addons (MOVED TO GITHUB) |
New
|
Undecided
|
Unassigned |
Bug Description
Fetchmail module installs a method to process mail messages from incoming mail servers.
This method is called by ir.cron periodically. ir.cron uses a db locking strategy on cron job record to prevent simoultaneous call by multiple workers threads on the same job.
Fetchmail cron method receives the cursor from cron and reuses it making a cr.commit on each received message, thus breaking the lock policy of to prevent simoultaneous execution. The net effect is that fetchmail is called several times when message collecting from input mail servers takes longer than the interval between cron calls (60 seconds)(a common situation when the server is configured with slow mail services). In my cases this process ends up with stalled cron fetchamail process, and thus NO MAIL WAS COLLECTED unless you manually reset the server
The solution is to use a separate cursor to process incoming messages
I have tested this situation on v6.1, but looking the code it is exactly the same in v7.0
Attached you will see a patch for v6.1, and I guess it is the same for v7.0
Gustavo, I also encounter this bug from time to time, thanks for the fix. See my pull request for odoo 7.0 at https:/ /github. com/odoo/ odoo/pull/ 585