Monday, June 2, 2014

InterfaceError: connection already closed

It seems that after updating to 1.6, we are running into an InterfaceError on different views at random times. I found the some older tickets below where the issues is apparently resolved, but it's not in my case. Could this be related to the ATOMIC setting for postgres? What could I be doing in my code that is screwing with the DB connection?

The full stack trace is below. It seems to be happening while the request is starting that the DB connection has already been closed?

We are running this on:
Ubuntu 12.04

Django 1.6.5
Psycopg 2.5.3


  File "django/core/handlers/base.py", line 88, in get_response
    response = middleware_method(request)
  File "django/middleware/locale.py", line 32, in process_request
    request, check_path=check_path)
  File "django/utils/translation/__init__.py", line 166, in get_language_from_request
    return _trans.get_language_from_request(request, check_path)
  File "django/utils/translation/trans_real.py", line 430, in get_language_from_request
    lang_code = request.session.get('django_language', None)
  File "django/contrib/sessions/backends/base.py", line 58, in get
    return self._session.get(key, default)
  File "django/contrib/sessions/backends/base.py", line 173, in _get_session
    self._session_cache = self.load()
  File "django/contrib/sessions/backends/db.py", line 20, in load
    expire_date__gt=timezone.now()
  File "django/db/models/manager.py", line 151, in get
    return self.get_queryset().get(*args, **kwargs)
  File "django/db/models/query.py", line 304, in get
    num = len(clone)
  File "django/db/models/query.py", line 77, in __len__
    self._fetch_all()
  File "django/db/models/query.py", line 857, in _fetch_all
    self._result_cache = list(self.iterator())
  File "django/db/models/query.py", line 220, in iterator
    for row in compiler.results_iter():
  File "django/db/models/sql/compiler.py", line 713, in results_iter
    for rows in self.execute_sql(MULTI):
  File "django/db/models/sql/compiler.py", line 785, in execute_sql
    cursor = self.connection.cursor()
  File "django/db/backends/__init__.py", line 162, in cursor
    cursor = util.CursorWrapper(self._cursor(), self)
  File "django/db/backends/__init__.py", line 134, in _cursor
    return self.create_cursor()
  File "django/db/utils.py", line 99, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "django/db/backends/__init__.py", line 134, in _cursor
    return self.create_cursor()
  File "django/db/backends/postgresql_psycopg2/base.py", line 137, in create_cursor
    cursor = self.connection.cursor()


Thanks!
Tim

--
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/e7c733f5-31e7-4953-8ff0-cc65a1d975f3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment