Comment 6 for bug 992525

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

This error is only supposed to happen when two transactions read *then* write data at the same time in the database, in a manner that may have produced different results if they were executed one after the other instead.
That should not happen frequently even when many users are working on the system at the same time, unless the users are all modifying the same data exactly at the same time.

Now, there are a few things that might cause this issue to happen too frequently, such as:
- two persons sharing the same login
- PostgreSQL 9.1 used in combination with an old psycopg2 Python library version (older than 2.4.3)

You can find out the psycopg2 version with this command on the OpenERP server machine:
      $ python -c 'import psycopg2;print psycopg2.__version__'
       2.4.3 (dt dec mx ext pq3)

Older Pyscopg2 versions did not fully support the transaction isolation mechanisms of PostgreSQL 9.1, and might cause this low-level protection to trigger too often.

In other cases, the trigger of this error is a protection mechanism that ensures proper data integrity, and is essential for the safety of the transactions. It is likely it did not happen as often with OpenERP 6.0, and the reason is that the protection mechanism used in OpenERP 6.0 was not as efficient, and may have missed certain kind of dangerous concurrent updates.
OpenERP 6.1 is fully using the Snapshot Serialization Isolation mechanism of PostgreSQL, an industry-standard solution for maintaining transaction integrity [1].

As discussed, we can further improve the user experience by adding an auto-retry mechanism in the transaction handling code, but the frequency of such errors is supposed to be quite low under normal circumstances.

[1] http://en.wikipedia.org/wiki/Snapshot_isolation