> The strange thing is that all requests are affected *after* the db
> restart.
>
> 1) I thought that django opened a new DB connection on each request, if so
> then it doesnt make sense that *all* requests after the DB restart raised
> an exception
me too, and in fact it does not make sense :(
>
> 2) Is it possible for uwsgi to restart a worker that comes at an
> exception?
Put something like this in your WSGI handler
def check_for_postgres_death(type, value, traceback):
# check for type, if it is postgres, exit the worker
...
...
sys.exit(0)
import sys
sys.excepthook = check_for_postgres_death
>
>
> uwsgi cmdline: uwsgi -s 127.0.0.1:9001 -M 4 -t30 --post-buffering 1 -A 4
> -p
> 6 -d /var/log/uwsgi.log --pidfile /var/run/uwsgi.pid --no-site --vhost
>
>
>
It looks like you are hosting multiple apps in the same uWSGI instance
(--vhost), psycopg2 does not perfectly support multiple interpreters. I
suppose this is why you get this behaviour.
(warning: post-buffering 1 is veary heavy, you can use higher value in
recent releases, 8192 is a good one)
--
Roberto De Ioris
http://unbit.it
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi