#13215: Random OperationalError when using FastCGI prefork + PostgreSQL
----------------------------+-----------------------------------------------
 Reporter:  hcarvalhoalves  |       Owner:  nobody    
   Status:  new             |   Milestone:            
Component:  Core framework  |     Version:  1.1       
 Keywords:                  |       Stage:  Unreviewed
Has_patch:  0               |  
----------------------------+-----------------------------------------------
 To reproduce:

 1. Setup a Django project with FCGI in prefork mode

 python manage.py runfcgi method=prefork

 2. Use psycopg2 as the database handler

 3. Setup an async FCGI web server to use your daemon (Cherokee, Lighttpd,
 Nginx)

 Randomly, some requests will result in the following traceback:

 {{{
 File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py", line
 86, in get_response
    response = callback(request, *callback_args, **callback_kwargs)

  File "/usr/lib/python2.6/site-packages/django/contrib/admin/sites.py",
 line 140, in root
    if not self.has_permission(request):

  File "/usr/lib/python2.6/site-packages/django/contrib/admin/sites.py",
 line 99, in has_permission
    return request.user.is_authenticated() and request.user.is_staff

  File "/usr/lib/python2.6/site-
 packages/django/contrib/auth/middleware.py", line 5, in __get__
    request._cached_user = get_user(request)

  File "/usr/lib/python2.6/site-packages/django/contrib/auth/__init__.py",
 line 83, in get_user
    user_id = request.session[SESSION_KEY]

  File "/usr/lib/python2.6/site-
 packages/django/contrib/sessions/backends/base.py", line 46, in
 __getitem__
    return self._session[key]

  File "/usr/lib/python2.6/site-
 packages/django/contrib/sessions/backends/base.py", line 172, in
 _get_session
    self._session_cache = self.load()

  File "/usr/lib/python2.6/site-
 packages/django/contrib/sessions/backends/db.py", line 16, in load
    expire_date__gt=datetime.datetime.now()

  File "/usr/lib/python2.6/site-packages/django/db/models/manager.py", line
 93, in get
    return self.get_query_set().get(*args, **kwargs)

  File "/usr/lib/python2.6/site-packages/django/db/models/query.py", line
 304, in get
    num = len(clone)

  File "/usr/lib/python2.6/site-packages/django/db/models/query.py", line
 160, in __len__
    self._result_cache = list(self.iterator())

  File "/usr/lib/python2.6/site-packages/django/db/models/query.py", line
 275, in iterator
    for row in self.query.results_iter():

  File "/usr/lib/python2.6/site-packages/django/db/models/sql/query.py",
 line 206, in results_iter
    for rows in self.execute_sql(MULTI):

  File "/usr/lib/python2.6/site-packages/django/db/models/sql/query.py",
 line 1734, in execute_sql
    cursor.execute(sql, params)

 OperationalError: server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
 }}}


 The bug doesn't appear to happend when using threaded mode, but it's hard
 to tell as it's completly random.

 For the record, had this issue with: Django 1.1, Cherokee 0.44.19,
 python-2.6, PostgreSQL-8.3

 Another report with the same issue, but different setup:
 http://stackoverflow.com/questions/393637/

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

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to