Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REF] sql_db: Add verbose traceback creating connections #591

Open
wants to merge 2 commits into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions odoo/modules/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
9 changes: 6 additions & 3 deletions odoo/sql_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down