audittrail should not hold a transaction in execute method

Bug #599008 reported by Albert Cervera i Areny - http://www.NaN-tic.com
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Critical
Christophe Simonis (OpenERP)

Bug Description

audittrail module overrides OpenERP's execute() function. It creates a new cursor, executes default execute() function and registers necessary events. The problem is that as the cursor created holds the transaction until the very end this may become incompatible with code of certain modules.

For example, full_text_search module must create a table which references "ir_model" table. As the transaction started by the cr record in audittrail module has done a SELECT on "ir_model" table, full_text_search CREATE TABLE statement cannot end until audittrail's cursor has finised and thus producing a deadlock.

The following diff solves the problem by setting cr cursor into autocommit mode. This way audittrail module does not interfere in transactions created by the functions it calls and thus making it really transparent as it should.

@@ -315,6 +300,7 @@
     def execute(self, db, uid, passwd, model, method, *args):
         pool = pooler.get_pool(db)
         cr = pooler.get_db(db).cursor()
+ cr.autocommit(True)
         try:
             proxy = pool.get(model)
             if proxy is None:

Revision history for this message
Albert Cervera i Areny - http://www.NaN-tic.com (albert-nan) wrote :

Here it's a diff with a file so indentation is honoured.

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

Hello Albert,

I would like to check this issue with a test case.

Can you provide one?

Thanks.

Revision history for this message
Albert Cervera i Areny - http://www.NaN-tic.com (albert-nan) wrote :

I think the test case is already explained. You can install full_text_search module which can be found here:

http://launchpad.net/openobject-client-kde/5.0/5.0.3/+download/full_text_search.zip

Once you have the module installed execute the following wizard:

Administration / Configuration / Full Text Search / Update Full Text Index

choose a language and press 'Create Index'.

This will hang forever if you have the 'audittrail' module installed.

Changed in openobject-addons:
importance: Undecided → Critical
status: New → Confirmed
assignee: nobody → Christophe (OpenERP) (kangol)
milestone: none → 5.0.15
Revision history for this message
Christophe Simonis (OpenERP) (kangol) wrote :

Fixed by 2854 <email address hidden>

Changed in openobject-addons:
status: Confirmed → Fix Released
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.