> I tried this with uwsgi-0.9.8.1, and it works in single process mode, but
> not in multi process mode (when using either --master, or --touch-reload)
>
> Vitaliy


This is the expected behaviour.

let me clarify this:

single process (no master):

the process creates the thread in which the WSGI callable put data.

- This is ok -

with master process:

the master load the app and generate the thread. Then it forks one or more
workers. This workers are new processes with no relation with the thread
spawned in the master. So your data will go nowhere (only the master can
access the initial thread).

You have two way to follow:

1) add --lazy to the command line, in this way your app will be loaded
after master's fork, so each worker will get its thread.

2) rewrite your app to use the uwsgi.post_fork_hook feature.

You will put your thread creation logic in a function assigned to
uwsgi.post_fork_hook that will be executed after each fork().

Let me know if it works for you

-- 
Roberto De Ioris
http://unbit.it
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to