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

database connection error triggers generic 500 error when ATOMIC_REQUESTS #139

Open
tisdall opened this issue Apr 23, 2019 · 0 comments
Open

Comments

@tisdall
Copy link
Contributor

tisdall commented Apr 23, 2019

Something seems to have broken PR #87 . When I hit watchman and a database isn't working, it triggers a generic error before reaching watchman and then I get emailed a stacktrace. I'm using Django 1.11.20. If I comment out ATOMIC_REQUESTS in DATABASES then it works properly.

@ulope was the original author of the patch, so maybe they have some insight

It seems like it checks for autocommit and that then calls ensure_connection which then raises an error.

Traceback:

File "/usr/local/lib/python2.7/site-packages/django/core/handlers/exception.py" in inner
  41.             response = get_response(request)

File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py" in _get_response
  187.                 response = self.process_exception_by_middleware(e, request)

File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py" in _get_response
  185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/usr/local/lib/python2.7/site-packages/django/utils/decorators.py" in inner
  184.                 with self:

File "/usr/local/lib/python2.7/site-packages/django/db/transaction.py" in __enter__
  158.             if not connection.get_autocommit():

File "/usr/local/lib/python2.7/site-packages/django/db/backends/base/base.py" in get_autocommit
  385.         self.ensure_connection()

File "/usr/local/lib/python2.7/site-packages/django/db/backends/base/base.py" in ensure_connection
  213.                 self.connect()

File "/usr/local/lib/python2.7/site-packages/django/db/utils.py" in __exit__
  94.                 six.reraise(dj_exc_type, dj_exc_value, traceback)

File "/usr/local/lib/python2.7/site-packages/django/db/backends/base/base.py" in ensure_connection
  213.                 self.connect()

File "/usr/local/lib/python2.7/site-packages/django/db/backends/base/base.py" in connect
  189.         self.connection = self.get_new_connection(conn_params)

File "/usr/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py" in get_new_connection
  274.         conn = Database.connect(**conn_params)

File "/usr/local/lib/python2.7/site-packages/MySQLdb/__init__.py" in Connect
  85.     return Connection(*args, **kwargs)

File "/usr/local/lib/python2.7/site-packages/MySQLdb/connections.py" in __init__
  204.         super(Connection, self).__init__(*args, **kwargs2)

Exception Type: OperationalError at /watchman/dashboard/
Exception Value: (2003, 'Can\'t connect to MySQL server on \'127.0.0.1\' (111 "Connection refused")')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants