From f915a679fabe392bdb9dd7d681999a4a5d59d1b1 Mon Sep 17 00:00:00 2001 From: Simon Lejeune Date: Fri, 10 Feb 2017 21:12:15 +0100 Subject: [PATCH] [FIX] web: database selector and manager The database manager and selector triggered an internal server error according to the modules installed. The issue is that some modules (like utm) overrode ir_http's dispatch and openned a cursor before calling super. Following rev[1], the database manager can tell you the incompatible databases. For that, it opens a new cursor to each database and get back the Odoo's version. After the information is fetched, the cursor is closed. Closing a cursor does not release it from the connection pool, so the database cannot be dropped and here comes the fix [2]: this commit removes all cursors to `database` from the connection pool. Now, if a module overrides the ir_http's dispatch and open a cursor before calling `super`, the automatic commit/close done at the end of a successful request cannot succeed in the database manager or selector as the cursor is closed during the call to super, leading to an internal server error. To workaround this issue, we explicitely set the cursor to None, as it will prevent the automatic commit/close at the end of the request. This is similar to rev 5c6087e38ee671ad5a3cf5aaa501d2a46af49872 [1] 96f703ff842d4b83e5431d4167d7ac6f40044c94 [2] 610036756ac25796d035e4a702416fd9fddc58da --- addons/web/controllers/main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index ab3f892a424..57eabbe75fb 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -639,10 +639,12 @@ class Database(http.Controller): @http.route('/web/database/selector', type='http', auth="none") def selector(self, **kw): + request._cr = None return self._render_template(manage=False) @http.route('/web/database/manager', type='http', auth="none") def manager(self, **kw): + request._cr = None return self._render_template() @http.route('/web/database/create', type='http', auth="none", methods=['POST'], csrf=False)