python - uWSGI processes lose Django sessions -
i wasted several hours without real solution, here problem: log django admin , or after few clicks thrown out.
i looked while in settings , configs. clue far uwsgi log files, example:
www.example.com [pid: 20047|app: 0|req: 1120/2060] 217.9.101.34 () {42 vars in 841 bytes} [thu jul 18 15:27:35 2013] /admin/ => ... www.example.com [pid: 20047|app: 0|req: 1122/2063] 217.9.101.34 () {40 vars in 786 bytes} [thu jul 18 15:27:37 2013] /admin/auth/ => ... www.example.com [pid: 20047|app: 0|req: 1124/2066] 217.9.101.34 () {40 vars in 801 bytes} [thu jul 18 15:27:39 2013] /admin/auth/user/ => ... www.example.com [pid: 20047|app: 0|req: 1125/2067] 217.9.101.34 () {40 vars in 740 bytes} [thu jul 18 15:27:39 2013] /admin/jsi18n/ => ... www.example.com [pid: 19082|app: 0|req: 947/2072] 217.9.101.34 () {42 vars in 841 bytes} [thu jul 18 15:27:41 2013] /admin/ => ... www.example.com [pid: 20047|app: 0|req: 1128/2081] 217.9.101.34 () {42 vars in 841 bytes} [thu jul 18 15:27:44 2013] /admin/auth/ the first few requests have same process id, that's i'm logged in. process takes on next request , apparently process doesn't know session , i'm logged out. next request has original id again cookie reset already.
i tried everything: settting project again, settings uwsgi config again, checking nginx, restarting everything, nothing helps. can not cookie error because appears on several browsers on several computers. , after all, cookies set , session gets logged database.
stack django 1.5.1, python 2.7, virtualenv, buildout, mysql 5.5, nginx, uwsgi, ubuntu 12.04
any ideas?
edit:
this uwsgi config:
[uwsgi] #vhost = true # tried see if helps plugins = python socket = /tmp/example.com.sock master = true enable-threads = true processes = 8 cheaper = 2 max-requests=1000 reload-on-rss=110 vacuum=true harakiri=20 buffer-size=16384 # added try if helps wsgi-file = /var/www/blabla/.../django.wsgi virtualenv = /var/www/blabla chdir = /var/www/blabla/... touch-reload = /var/www/blabla/.../django.wsgi
by default, django stores sessions in database, problem due bug: https://code.djangoproject.com/ticket/20537
consider updating uwsgi >= 1.2.6
Comments
Post a Comment