[Django] #25362: psycopg2.InterfaceError is not handled

23 views
Skip to first unread message

Django

unread,
Sep 7, 2015, 6:43:33 AM9/7/15
to django-...@googlegroups.com
#25362: psycopg2.InterfaceError is not handled
-------------------------------+--------------------
Reporter: ambasta | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.6
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
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

--
Ticket URL: <https://code.djangoproject.com/ticket/25362>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Sep 7, 2015, 7:34:55 AM9/7/15
to django-...@googlegroups.com
#25362: psycopg2.InterfaceError is not handled
-------------------------------+--------------------------------------

Reporter: ambasta | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by ambasta):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

Also explaining our current setup

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

--
Ticket URL: <https://code.djangoproject.com/ticket/25362#comment:1>

Django

unread,
Sep 7, 2015, 8:40:02 AM9/7/15
to django-...@googlegroups.com
#25362: psycopg2.InterfaceError is not handled
-------------------------------------+-------------------------------------

Reporter: ambasta | Owner: nobody
Type: Uncategorized | Status: new
Component: Database layer | Version: 1.6
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* component: Uncategorized => Database layer (models, ORM)


Old description:

> 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

New description:

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
}}}

--

--
Ticket URL: <https://code.djangoproject.com/ticket/25362#comment:2>

Django

unread,
Sep 7, 2015, 8:41:59 AM9/7/15
to django-...@googlegroups.com
#25362: psycopg2.InterfaceError is not handled
-------------------------------------+-------------------------------------

Reporter: ambasta | Owner: nobody
Type: Uncategorized | Status: new
Component: Database layer | Version: 1.6
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by timgraham):

I think it's a duplicate of #15802 and #24810. Could you confirm?

--
Ticket URL: <https://code.djangoproject.com/ticket/25362#comment:3>

Django

unread,
Sep 7, 2015, 9:38:30 AM9/7/15
to django-...@googlegroups.com
#25362: psycopg2.InterfaceError is not handled
-------------------------------------+-------------------------------------
Reporter: ambasta | Owner: nobody
Type: Uncategorized | Status: closed

Component: Database layer | Version: 1.6
(models, ORM) |
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage:
| Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by aaugustin):

* status: new => closed
* resolution: => duplicate


Comment:

The reporter indicates they're using Django 1.6 while #21553 was fixed in
Django 1.8.

Closing as a duplicate of #21553.

--
Ticket URL: <https://code.djangoproject.com/ticket/25362#comment:4>

Reply all
Reply to author
Forward
0 new messages