odoo/openerp/osv
Olivier Dony 2b1cdd551f [FIX] fields.float: avoid non-deterministic side-effects on other cursors
In 5efac22043 and
1cf5723835 the computation
of the decimal precision of float fields was modified to
reuse a random cursor from the request environments.
Environment.envs is a WeakSet, subject to unpredictable
garbage collections.

This could cause hard-to-diagnose problems by executing
a SELECT query in a cursor that is supposed to be
otherwise idle and untouched.

As an example, this could cause a transaction start in a
cursor that was just committed/rolled back,
and was waiting for another operation to complete.

One such case happened semi-randomly during a module
installation triggered from the web client, where the request
cursor is committed and waiting for the registry
initialization done with a different cursor,
in the middle of _button_immediate_function()

After the registry initialization, the request cursor is
used again to determine the next action (ir.actions.todo),
and this could cause a TransactionRollbackError if the
request cursor was used during the initialization.

Using a new cursor every time is much safer, simpler,
and will not cause any significant performance hit,
because it will usually grab an available connection
from the connection pool, rather than create a new one.

Fixes opw-649151
2015-09-15 19:38:19 +02:00
..
__init__.py [MERGE] new v8 api by rco 2014-07-06 17:05:41 +02:00
expression.py [FIX] expression: table alias reaching 64 characters limits 2015-09-08 11:53:18 +02:00
fields.py [FIX] fields.float: avoid non-deterministic side-effects on other cursors 2015-09-15 19:38:19 +02:00
orm.py [FIX] account, mail, etc.: uniformize evaluated expressions 2015-05-21 15:26:35 +02:00
osv.py [MERGE] new v8 api by rco 2014-07-06 17:05:41 +02:00
query.py [REM] Deleted .apidoc lines. 2013-02-12 15:24:10 +01:00