Hi,

I encountered a problem where using uwsgi --gevent-monkey-patch would cause
hangs. Is it possible that the monkey patching is possibly done too late?
Here's my setup:

SQLAlchemy 0.8.1
PyMySQL 0.5
gevent 1.0rc2
uwsgi 1.9.12
nginx 1.4.0 (probably not relevant)

uWSGI command line:

uwsgi --socket mysite.sock --wsgi-file app.py --chmod-socket=666
--processes 2 -l 5000 -L --daemonize log --gevent 512 --gevent-monkey-patch

This is the Python app I was running:

https://gist.github.com/MalcolmEvershed/5862679

When I had 256 concurrent HTTP Keep-Alive connections requesting /dbsraw,
the app would hang. Then if I remove --gevent-monkey-patch from the uWSGI
command line, and I instead use "from gevent import monkey;
monkey.patch_all()" at the top of app.py, there is no hang and everything
works fine.

My theory is that SQLAlchemy uses various threading primitives to block
threads/greenlets when implementing database connection pooling, and if
those primitives aren't monkey patched properly, then this results in a
hang. But I could be wrong.

Anyway, I wanted to give a heads-up in case this issue isn't already known
about, or if I'm doing something wrong.

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

Reply via email to