From eb19016ba35d4dc4723edcc244fd412680b5ff2f Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Fri, 21 Dec 2018 15:56:22 +0100 Subject: [PATCH] [REV] Revert "[FIX] modules: load demo data fallback" This reverts commit 5f4a9451828fff1919c74e421001bc111c5c138d. The cure is worse than the original disease. The main installation cursor often holds exclusive locks (due to DDL changes) on vital tables such as res_users. As a result, using another cursor to perform changes while the main cursor is waiting is extremely deadlock-prone. And these deadlocks can't be detected by PostgreSQL as they mix Python-SQL locking, which leads to deadlocked HTTP workers. Related to: - opw-1916918 - #29528 --- odoo/modules/loading.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/odoo/modules/loading.py b/odoo/modules/loading.py index f63fdde437b..5fb56887948 100644 --- a/odoo/modules/loading.py +++ b/odoo/modules/loading.py @@ -89,15 +89,13 @@ def load_demo(cr, package, idref, mode, report=None): "Module %s demo data failed to install, installed without demo data", package.name, exc_info=True) - registry = odoo.registry(cr.dbname) - with registry.cursor() as cr: - env = api.Environment(cr, SUPERUSER_ID, {}) - todo = env.ref('base.demo_failure_todo', raise_if_not_found=False) - Failure = env.get('ir.demo_failure') - if todo and Failure is not None: - todo.state = 'open' - Failure.create({'module_id': package.id, 'error': str(e)}) - return False + env = api.Environment(cr, SUPERUSER_ID, {}) + todo = env.ref('base.demo_failure_todo', raise_if_not_found=False) + Failure = env.get('ir.demo_failure') + if todo and Failure is not None: + todo.state = 'open' + Failure.create({'module_id': package.id, 'error': str(e)}) + return False def force_demo(cr):