[Flask] [mattupstate/flask-security] can't work with gunicorn with multiple works? (#579)

Unai Rodriguez unai at sysbible.org
Tue Jan 10 04:19:26 EST 2017

How do you determine that a user is authenticated? I suspect that
currently your application stores information individually on each
of the Gunicorn workers processes memory so it is different on
each of them.

I found these links that can help you understand what can be wrong
on our app:



You could either re-architect your app or look at doing something like
this, mentioned on the first link:

> Alternatively, you could use a memory-mapped file[1] (if you can wrap
> the shared memory with your custom data structure), gevent with
> gunicorn[2] to ensure that you're only using one *process*, or the multi-
> processing module to spin up your own data-structure server[3] which
> you connect to using IPC.

-- unai

On Tue, Jan 10, 2017, at 03:57 PM, 王帅 wrote:

> Thanks for your reply. 


> I use MySQL database behind Flask-SQLAlchemy. The full example app
> host at https://github.com/stamaimer/MPWeChatRSS.

> On 10 Jan 2017, 3:41 PM +0800, Jiri Kuncar
> <notifications at github.com>, wrote:

>> Can you provide full example app? Is it possible that you are using
>> SQLite in-memory database?
>> — You are receiving this because you authored the thread.  Reply to
>> this email directly, view it on GitHub[4], or mute the thread[5].

> _________________________________________________

> Flask mailing list

> Flask at python.org

> https://mail.python.org/mailman/listinfo/flask


  1. http://stackoverflow.com/questions/26854594/sharing-static-global-data-among-processes-in-a-gunicorn-flask-app
  2. http://stackoverflow.com/questions/26854594/sharing-static-global-data-among-processes-in-a-gunicorn-flask-app
  3. http://stackoverflow.com/questions/16366124/share-a-numpy-array-in-gunicorn-processes
  4. https://github.com/mattupstate/flask-security/issues/579#issuecomment-271507035
  5. https://github.com/notifications/unsubscribe-auth/ADlNSm1ukQPA_l-41OCf7bJDzFPXBspmks5rQzY4gaJpZM4LfB9k
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20170110/2907896a/attachment.html>

More information about the Flask mailing list