← Back to team overview

openerp-expert-framework team mailing list archive

Exception TransactionRollbackError not correctly handled ?

 

Hi,

I'm not a database expert, so I might need your guidance ! ;)

While using openerp, Psycopg2 raises TransactionRollbackError quite often even on small database. This does not seem to be easily reproduceable as it seems to be a conflict between two thread accessing the same table.

This occurs mostly at module installation. And can completely mess up
the module installation by giving empty wizard windows of instance.

So it's not just annoying, this can break badly a database. I guess it could also occurs in other situations (in multi-user context), where the bug would be quite difficult to reproduce and with unforeseeable consequences ;)

In my case (single user), it seem to hit more often on fast computers. To make a probable better guess, it seems to hurt more often whenever using a local connection between the browser and the server. It could be about the web module trying to update the res_users session info and may collide with normal operation.

On my computer, from a new database, installing the 'base_crypt' will trigger the exception. When using a distant connection, the bug won't show up. Please check the video I've posted with the bug report if you want to have more detail on the procedure I used.

Please don't focus on the fact 'base_crypt' is a module that have to deal with res_user. That's not a 'base_crypt' issue, even if it is the easiest way for me to illustrate this bug. I've managed to trigger this bug with a lot of different modules that have no relation with res_user table.

To give more info on non-base_crypt errors, this is a SQL query that is often triggering the TransactionRollbackError::

  UPDATE res_users
    SET
        date=now() AT TIME ZONE 'UTC'
    WHERE
        id=1
      AND password=E'$1$ctHfTPNo$0BbeJr1qjUDCINSQh8zci.'
      AND active
    RETURNING id

And here is a bug report which I found while doing mine:
https://bugs.launchpad.net/openobject-server/+bug/956715


After looking quickly on the net, I found that it's perfectly "normal" to receive this exception from postgres, and that the openerp engine should simply retry a little bit later.

Is this info correct ? If yes, I provided a quick patch that works well in my case. But it should be reviewed carefully as I'm not particularly aware of database world.

merge proposal:
https://code.launchpad.net/~vaab/openobject-server/fix-transactionrollbackerror-by-retrying/+merge/104233

bug report:
https://bugs.launchpad.net/openobject-server/+bug/992525

Thx for caring,
--
Valentin LAB

tel:  +33 6 71 39 62 13
mail: valentin.lab@xxxxxxxxxxx


Follow ups