persistent db connections and postgresql_psycopg2 InterfaceError
Hi,
does anyone have used django1.6 persistent connections with postgresql?
I've done a simple test and I'm not sure, that django behaves correctly.
Django can't recover after DB restart, and all further db requests lead to server error:
---------------
Traceback (most recent call last):
File "/venv/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 194, in __call__
signals.request_started.send(sender=self.__class__)
File "/venv/local/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 185, in send
response = receiver(signal=self, sender=sender, **named)
File "/venv/local/lib/python2.7/site-packages/django/db/__init__.py", line 95, in close_old_connections
conn.close_if_unusable_or_obsolete()
File "/venv/local/lib/python2.7/site-packages/django/db/backends/__init__.py", line 466, in close_if_unusable_or_obsolete
if self.is_usable():
File "/venv/local/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 196, in is_usable
self.connection.cursor().execute("SELECT 1")
psycopg2.InterfaceError: connection already closed
---------------
So, InterfaceError is not catched by django in postgresql_psycopg2.DatabaseWrapper.is_usable.
My test environment is:
Ubuntu 13.10
postgresql 9.1
Django==1.6.1
psycopg2==2.5.1
uWSGI==1.9.21.1
-- does anyone have used django1.6 persistent connections with postgresql?
I've done a simple test and I'm not sure, that django behaves correctly.
Django can't recover after DB restart, and all further db requests lead to server error:
---------------
Traceback (most recent call last):
File "/venv/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 194, in __call__
signals.request_started.send(sender=self.__class__)
File "/venv/local/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 185, in send
response = receiver(signal=self, sender=sender, **named)
File "/venv/local/lib/python2.7/site-packages/django/db/__init__.py", line 95, in close_old_connections
conn.close_if_unusable_or_obsolete()
File "/venv/local/lib/python2.7/site-packages/django/db/backends/__init__.py", line 466, in close_if_unusable_or_obsolete
if self.is_usable():
File "/venv/local/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 196, in is_usable
self.connection.cursor().execute("SELECT 1")
psycopg2.InterfaceError: connection already closed
---------------
So, InterfaceError is not catched by django in postgresql_psycopg2.DatabaseWrapper.is_usable.
My test environment is:
Ubuntu 13.10
postgresql 9.1
Django==1.6.1
psycopg2==2.5.1
uWSGI==1.9.21.1
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/77922966-a48e-4284-badd-e93f052fff54%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home