RafaelMiquelino / dash-flask-login

Implementation of Flask-login on top of Dash.
MIT License
247 stars 81 forks source link

issue with gunicorn #2

Closed HerrTeuer closed 4 years ago

HerrTeuer commented 5 years ago

when I deploy this app with gunicorn and assign more than one worker, the judgement current_user.is_authenticated does not work from tome to time. Althorough I have logged in, and the url is /success, the page content is /login_fd

EdenOaksConsulting commented 5 years ago

I was able to replicate this issue as described with intermittent /success and /login_fd results with >1 worker. gunicorn can have --threads >1 but the --workers >1 causes the issue.

This appears to affect flask-login, and setting the --preload option corrects the issue in my testing even with multiple workers and threads.

gunicorn --workers 5 --threads 5 --bind unix:dash.sock -m 007 app:server --preload

See also: https://stackoverflow.com/questions/39684364/heroku-gunicorn-flask-login-is-not-working-properly