> Hi list,
>
> We've hit a known python bug and are wondering how to workaround it when
> using uWSGI as our app container.
>
> In a nutshell, the underlying _strptime module used by Python (in things
> like time.strptime) is not thread safe. The official workaround when
> working in a threaded environment is to import _strptime before starting
> threads. For background on the bug see: http://bugs.python.org/issue7980
> and
> http://stackoverflow.com/questions/2427240/thread-safe-equivalent-to-pythons-time-strptime
>
> We have a Flask app (python 2.7 code) running under threaded uWSGI.
> Relevant config lines:
>
> processes: 4
> threads: 50
> thunder-lock: true
> thread-stacksize: 512
> home: /opt/webapps/venvs/%n
> pythonpath: /srv/webapps/%n
> wsgi-file: /srv/webapps/%n/run.py
> callable: app
>
> Is there a way we can instruct uWSGI to import _strptime before starting
> any threads? Apparently this is possible with mod_wsgi (see:
> http://modwsgi.readthedocs.io/en/develop/user-guides/application-issues.html#non-blocking-module-imports).
>
> Many thanks,
> Charlie
>


The --shared-pyimport <import> option should be enough(import can be an
ad-hoc module where you call strptime)
-- 
Roberto De Ioris
http://unbit.com
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to