OperationalError: no connection to the server using Django and gunicorn

206 views
Skip to first unread message

Adrián Ribao

unread,
May 26, 2011, 6:20:09 PM5/26/11
to Django users
Hello,

I'm testing gunicorn in the server, and I get this error in every
request:

Traceback (most recent call last):
File "project/env/lib/python2.6/site-packages/gunicorn/workers/
async.py", line 62, in handle_request
respiter = self.wsgi(environ, resp.start_response)
File "project/env/lib/python2.6/site-packages/django/contrib/
staticfiles/handlers.py", line 68, in __call__
return self.application(environ, start_response)
File "project/env/lib/python2.6/site-packages/django/core/handlers/
wsgi.py", line 273, in __call__
response = self.get_response(request)
File "project/env/lib/python2.6/site-packages/django/core/handlers/
base.py", line 168, in get_response
receivers =
signals.got_request_exception.send(sender=self.__class__,
request=request)
File "project/env/lib/python2.6/site-packages/django/dispatch/
dispatcher.py", line 172, in send
response = receiver(signal=self, sender=sender, **named)
File "project/env/lib/python2.6/site-packages/django/db/
__init__.py", line 101, in _rollback_on_exception
transaction.rollback_unless_managed(using=conn)
File "project/env/lib/python2.6/site-packages/django/db/
transaction.py", line 133, in rollback_unless_managed
connection.rollback_unless_managed()
File "project/env/lib/python2.6/site-packages/django/db/backends/
__init__.py", line 193, in rollback_unless_managed
self._rollback()
File "project/env/lib/python2.6/site-packages/django/db/backends/
__init__.py", line 50, in _rollback
return self.connection.rollback()

Is working ok with mod_wsgi.

I'm using Debian 6.0 with Django 1.3, postgis for geodjango, the
latest stable version of gunicorn 0.12.1 and gevent. I've been trying
with a sync worker but I got the same error.

I have no idea what's wrong.

Any ideas?

Thank you!

Adrian

Shawn Milochik

unread,
May 26, 2011, 10:23:42 PM5/26/11
to django...@googlegroups.com
What's the command you're using to run it?

Are you in screen? Are you using supervisor or anything like that?


Adrián Ribao

unread,
May 27, 2011, 5:53:48 AM5/27/11
to Django users
I'm doing it manually because I'm just testing:

./manage.py run_gunicorn -c gunicorn.conf.py

where gunicorn.conf.py

# -*- coding: utf-8 -*-
import multiprocessing

bind = "127.0.0.1:8000"
workers = multiprocessing.cpu_count() * 2 + 1
worker_class = 'gevent'

Андрей Махнач

unread,
Jun 30, 2011, 7:38:14 PM6/30/11
to Django users
Hi Adrian,

Have you solved this weird issue?

if yes, please tell me how.

Best regards,
Andrey Makhnach

Adrián Ribao Martínez

unread,
Jul 1, 2011, 3:16:29 AM7/1/11
to django...@googlegroups.com
I think that the error comes only when starting the server.

Reload the page about 10 times and check if you still get the error.

Regards,

Adrián

Андрей Махнач

unread,
Jul 1, 2011, 4:32:28 AM7/1/11
to Django users
I'm getting this error randomly
and it throws 500error to nginx (I'm using nginx+gunicorn)

and it appears really randomly ;)

Adrian Ribao

unread,
Jul 8, 2011, 5:39:26 AM7/8/11
to django...@googlegroups.com
I still have the same problem using gevent with gunicorn, but it works with synchronous workers.

Did you find a solution?

2011/7/1 Андрей Махнач <andrey....@gmail.com>
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.


Reply all
Reply to author
Forward
0 new messages