Until recently, I was occasionally getting the following errors, if I rapidly reloaded our application that generates a couple of ajax calls on the startup:
ProgrammingError: execute cannot be used while an asynchronous query is underway DatabaseError: execute cannot be used while an asynchronous query is underwayAfter getting the following versions:
Django 1.4 b1 Gunicorn 0.14 Gevent 0.13.6 psycopg2 2.4.4And greening psycopg2 pre_fork like this (in the Gunicorn config):
worker_class = "gevent" def def_pre_fork(server, worker): from psyco_gevent import make_psycopg_green make_psycopg_green() worker.log.info("Made Psycopg Green") pre_fork = def_pre_forkAnd using the gunicorn_django in a virtualenv to run the server from supervisor (instead of the manage.py shortcut):
[program:photobooks] command=/path/bin/gunicorn_django -c /path/conf/photobooks_gunicorn.conf.py directory=/path/src/photobooks environment=PATH="/path/bin"I was not able to reproduce the problem any more.
Could this be related to threading? The runserver command in Django 1.4 (maybe past releases as well, I'm not sure) has a --nothreading command. Did you try the runserver with this?
ReplyDeleteAlso curious if you're using werkzeug and if that causes any unintended effects when debugging a "green" server.
Thank you for being you
ReplyDelete