On Sun, Apr 13, 2014 at 7:12 PM, Matt Connolly <[email protected]> wrote:
> 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.). > pyzmq has the same mechanism - ctx.destroy([linger]) closes sockets before calling term. It is not at all threadsafe, so should only ever be used in single-threaded applications, or with extreme caution. It's easy to segfault with this if you are using sockets in threads. -MinRK > 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 <[email protected]> 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. <[email protected]> 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 > [email protected] > _______________________________________________ > zeromq-dev mailing list > [email protected] > http://lists.zeromq.org/mailman/listinfo/zeromq-dev > > > _______________________________________________ > zeromq-dev mailing list > [email protected] > http://lists.zeromq.org/mailman/listinfo/zeromq-dev > > > > _______________________________________________ > zeromq-dev mailing list > [email protected] > http://lists.zeromq.org/mailman/listinfo/zeromq-dev > >
_______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
