Opened 9 years ago

Last modified 9 years ago

#25362 closed Uncategorized

psycopg2.InterfaceError is not handled — at Version 2

Reported by: Amit Prakash Ambasta Owned by: nobody
Component: Database layer (models, ORM) Version: 1.6
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Tim Graham)

Similar to ticket #21553 psycopg2.InterfaceError is not handled correctly and leads to django re-using the same connection despite it being closed.

StackTrace Below:
Traceback (most recent call last):
  File "/home/ubuntu/.virtualenvs/express/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 194, in __call__
    signals.request_started.send(sender=self.__class__)
  File "/home/ubuntu/.virtualenvs/express/local/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 185, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/home/ubuntu/.virtualenvs/express/local/lib/python2.7/site-packages/django/db/__init__.py", line 94, in close_old_connections
    conn.close_if_unusable_or_obsolete()
  File "/home/ubuntu/.virtualenvs/express/local/lib/python2.7/site-packages/django/db/backends/__init__.py", line 462, in close_if_unusable_or_obsolete
    if self.is_usable():
  File "/home/ubuntu/.virtualenvs/express/local/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 192, in is_usable
    self.connection.cursor().execute("SELECT 1")
psycopg2.InterfaceError: connection already closed

Change History (2)

comment:1 by Amit Prakash Ambasta, 9 years ago

Also explaining our current setup

Django (running via uwsgi) connects to pgbouncer( via psycopg2 ) behind an ELB.
PgBouncer connects to a RDS service directly.

comment:2 by Tim Graham, 9 years ago

Component: UncategorizedDatabase layer (models, ORM)
Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top