[zeromq-dev] Incompatibility between PyZMQ and uWSGI

Brian Granger ellisonbg at gmail.com
Tue Nov 23 21:06:27 CET 2010


Jaime,

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

Hope this helps.

Brian

2010/11/23 Jaime Fernández <jjjaime at gmail.com>

> Hi all,
>
> I'm using the Python binding for ZMQ.Initially I was using 2 patterns:
> REQ/REP and PUSH/PULL with the reference WSGi server (wsgiref) and
> everything worked perfectly.
>
> Yesterday, I decided to move the code to a sandbox based on 2 Ubuntu
> machines (Ubuntu 10.04 LTS). I installed the latest versions of zmq and
> pyzmq (both of them were 2.0.10) available in the website as tar.gz.
> Although everything compiled, the PUSH/PULL messages were not exchanged
> (even in the same machine). Everything was solved after downloading the GIT
> version of both zmq and pyzmq.
>
> However, the unsolved problem is that zmq (or pyzmq) does not work when
> executed in uWSGI server. I don't know what's the reason of the problem but
> no zmq message is sent from the code executed inside the uWSGI. However, if
> the code is executed inside wsgiref, ZMQ works perfectly.
>
> Do you know what can cause this behaviour? Any solution? Could another ZMQ
> version fix the problem?
>
> Thanks in advance,
> Jaime
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>


-- 
Brian E. Granger, Ph.D.
Assistant Professor of Physics
Cal Poly State University, San Luis Obispo
bgranger at calpoly.edu
ellisonbg at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20101123/8b44423b/attachment.htm>


More information about the zeromq-dev mailing list