From 4664d54e1deceea4a40128749844d014bd4048d8 Mon Sep 17 00:00:00 2001 From: "Moises Lopez - https://www.vauxoo.com/" Date: Thu, 25 Apr 2024 12:57:02 -0600 Subject: [PATCH 1/2] [REF] sql_db: Add verbose traceback creating connections --- odoo/sql_db.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/odoo/sql_db.py b/odoo/sql_db.py index f7ff8d8e2d379..d52fd8c2a2f2c 100644 --- a/odoo/sql_db.py +++ b/odoo/sql_db.py @@ -614,8 +614,8 @@ def __repr__(self): count = len(self._connections) return "ConnectionPool(used=%d/count=%d/max=%d)" % (used, count, self._maxconn) - def _debug(self, msg, *args): - _logger_conn.debug(('%r ' + msg), self, *args) + def _debug(self, msg, *args, **kwargs): + _logger_conn.debug(('%r ' + msg), self, *args, **kwargs) @locked def borrow(self, connection_info): @@ -649,6 +649,7 @@ def borrow(self, connection_info): self._connections.append((cnx, True)) self._debug('Borrow existing connection to %r at index %d', cnx.dsn, i) + return cnx if len(self._connections) >= self._maxconn: @@ -672,7 +673,9 @@ def borrow(self, connection_info): _logger.info('Connection to the database failed') raise self._connections.append((result, True)) - self._debug('Create new connection backend PID %d', result.get_backend_pid()) + import traceback + + self._debug('Create new connection backend PID %d. tcbk %s', result.get_backend_pid(), traceback.extract_stack(), exc_info=True) return result @locked From d8423a99e2ec93a96850cd4ccf8a722abb705740 Mon Sep 17 00:00:00 2001 From: "Moises Lopez - https://www.vauxoo.com/" Date: Thu, 25 Apr 2024 18:09:26 -0600 Subject: [PATCH 2/2] [REF] registry: Add debug logger --- odoo/modules/registry.py | 1 + 1 file changed, 1 insertion(+) diff --git a/odoo/modules/registry.py b/odoo/modules/registry.py index 792fd3ba20bbc..94d757c292d66 100644 --- a/odoo/modules/registry.py +++ b/odoo/modules/registry.py @@ -783,6 +783,7 @@ def check_signaling(self): self.registry_sequence = r self.cache_sequence = c + _logger.debug("Registry used %s", self) return self def signal_changes(self):