[uWSGI] python wsgi application is imported before forking worker process ?

Charles Law charles.law at openx.com
Fri Oct 25 03:05:26 CEST 2013


We get around this issue by making a method (with a postfork decorator)
that loads several things after forking:

http://uwsgi-docs.readthedocs.org/en/latest/PythonDecorators.html#uwsgidecorators.postfork

-Charles


On Thu, Oct 24, 2013 at 5:57 PM, yi huang <yi.codeplayer at gmail.com> wrote:

> Today we found a strange bug in my application when deployed with uwsgi.
> It turns out that our application created some tcp connections and store
> them in a pool at import time, and we found that different worker processes
> shared the same connections, which cause some strange behavior.
>
> I guess this is because uwsgi fork worker processes after import python
> application, so the file descriptors created at import time are shared
> among worker processes.
>
> I wonder is this behavior normal? If it is normal, then what is the
> recommended way to do initialization related to file descriptors.
>
> Thanks.
>
>
> --
> http://yi-programmer.com/
>
> _______________________________________________
> uWSGI mailing list
> uWSGI at lists.unbit.it
> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
>
>


-- 
Charles Law   Software Developer
Watch how we make online advertising simple: http://bit.ly/Ent_vid
www.openx.com <http://www.openx.org/>   |   follow us on:
Twitter<http://twitter.com/openx>
   Facebook <http://www.facebook.com/OpenX>
LinkedIn<http://www.linkedin.com/company/openx/products>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.unbit.it/pipermail/uwsgi/attachments/20131024/71f9067f/attachment.html>


More information about the uWSGI mailing list