[uWSGI] Incompatibility between PyZMQ and uWSGI

Jaime Fernández jjjaime at gmail.com
Wed Nov 24 10:21:35 CET 2010

Hi Roberto,

Thanks for the reply. I've tested with -T flag but it does not work either.

In the ZMQ I've received the following reply (
which may be helpful:
I think the issue is that uWSGI likely uses an asynchronous event loop
underneath with non-blocking sockets.  When zeromq/pyzmq is used in that
context, zeromq socket have to be integrated into the event loop at a very
low level using:
1) zmq_poll (for zeromq 2.0.x and 2.1.x)
2) ZMQ_FD/ZMQ_EVENTS (for zeromq 2.1.x)
The exact point of conflict is that both zeromq and uWSGI are using
something like poll to handle IO in the event loop.  The two event loops
don't know how to coordinate their activities and end up stepping on each
other's toes.  The only libraries that I know of that handle this (in python
that is) are:
1) pyzmq.eventloop.ioloop (a tornado-compatible event loop).
2) eventlet
Unfortunately I don't know how to proceed.


On Tue, Nov 23, 2010 at 7:44 PM, Roberto De Ioris <roberto at unbit.it> wrote:

> > We are developing a web project and the web interface is managed by NGINX
> > and uWSGI handlers. It works rather fine although we haven't tested in a
> > production environment yet.
> >
> > Now, we have introduced zeromq (http://www.zeromq.org/), which let us
> > build
> > a lightweight messaging framework. During the development, we've used
> > wsgiref for simplicity and everything worked perfectly. However, when we
> > moved the source code to our sandbox based on nginx+uWSGi, the zmq code
> > didn't work correctly. The messages were not sent.
> >
> > Do you know what could cause this conflict? Perhaps parallelism and
> > threading implementations of both frameworks are colliding?
> >
> > I've also introduced this problem in the zmq forum just in case:
> > http://lists.zeromq.org/pipermail/zeromq-dev/2010-November/008082.html
> >
> > Thanks in advanced for your help,
> > Jaime
> > _______________________________________________
> >
> i am not very familiar with zeromq.
> I will try it tomorrow. The only "relevant" difference in uWSGI against a
> standard python interpreter is that threads are not enabled by default. If
> zeromq uses it you have to add the -T flag. This is only a speculation, i
> will report yout tomorrow what i have discovered.
> (but in the mean time try with the -T flag)
> --
> Roberto De Ioris
> http://unbit.it
> _______________________________________________
> uWSGI mailing list
> uWSGI at lists.unbit.it
> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.unbit.it/pipermail/uwsgi/attachments/20101124/b4362be8/attachment.htm 

More information about the uWSGI mailing list