Opened 11 years ago
Closed 11 years ago
#22556 closed Uncategorized (fixed)
close_if_unusuable_or_obsolete should handle InterfaceError
Reported by: | Raymond Penners | 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
With Django 1.6.2 I ran into the following stack trace:
... close_old_connections() File "/somewhere/virtualenv/local/lib/python2.7/site-packages/django/db/__init__.py", line 94, in close_old_connections conn.close_if_unusable_or_obsolete() File "/somewhere/virtualenv/local/lib/python2.7/site-packages/django/db/backends/__init__.py", line 462, in close_if_unusable_or_obsolete if self.is_usable(): File "/somewhere/virtualenv/local/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 192, in is_usable self.connection.cursor().execute("SELECT 1") InterfaceError: connection already closed <... at 0xac6ec0c> failed with InterfaceError
I see that close_if_unusuable_or_obsolete
gracefully handles DatabaseError
exceptions. Shouldn't InterfaceError
be caught as well?
FWIW -- I am invoking close_old_connections
myself because I am making heavy use of greenlets. I would like to call a Django method to close connections if needed, without having to worry about exceptions like these.
Change History (3)
comment:1 by , 11 years ago
comment:3 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Can you please try with 1.6.4? This may have been fixed in #21202.