[zeromq-dev] [pyzmq] Cython vs CFFI backends

Matt Connolly matt.connolly at me.com
Mon Apr 14 04:12:30 CEST 2014


I had a similar issue with the ruby gem “rbczmq” which wraps CZMQ.

CZMQ itself wraps the ZMQ context and does its own socket close (with linger set) before asking ZMQ context terminate. This process is not thread safe and I needed to use a mutex to ensure that no other sockets were closed during this shutdown. (In ruby this could be triggered by a garbage collect of a socket object.).

Using a mutex for socket close would have a penalty if many sockets need to be opened and closed quickly, however, I understand this isn’t a recommended pattern anyway.

Best,
Matt.


On 14 Apr 2014, at 8:41 am, Michi Henning <michi at triodia.com> wrote:

> I just went through a similar experience. In my case, the problem was that close()
> wasn't called from the same thread that created the socket.
> 
> You may find the explanations here useful:
> 
> http://zeromq.org/whitepapers:0mq-termination
> 
> Debugging these hands is a real pain. Is there anything that could be added to the Zmq API
> to make this easier? For example, getting a list of unclosed sockets would be ultra-useful,
> as would be warnings if a socket is closed from a thread other than the one that created it.
> 
> Cheers,
> 
> Michi.
> 
> 
> On 14 Apr 2014, at 8:29 , Alexander S. <alexander at thequery.net> wrote:
> 
>> Hey all.
>> 
>> I am debugging a hang in my application: the ctx.linger option is set before creating any sockets, but it still hangs on ctx.term().
>> 
>> While scanning the pyzmq code I noticed the CFFI backend supports passing a linger parameter to the term() call whereas the Cython backend does not. This does not appear to be documented. Is there a reason for this difference? Or can I simply code up a pull request to add the linger parameter?
>> 
>> More generally, is PyPy the only reason one would use the CFFI backend? That is, can I compile pyzmq to use CFFI with CPython? And do we have a published list of differences/features supported by the two backends?
>> 
>> Lot's of questions. :) Thanks for the help!
>> --------------------
>> Alexander Sideropoulos
>> alexander at thequery.net
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> 
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140414/216aee55/attachment.htm>


More information about the zeromq-dev mailing list