On Fri, Aug 30, 2013 at 3:12 PM, Matt Connolly <matt.conno...@me.com> wrote:

> I've been looking at a similar scenario using ruby.
>
> As far as I can tell you cannot even touch anything relating to the
> parents context in the child, including closing it. I haven't fully tested
> it out but it looks to me like the pipes used for internal communication in
> the context will cause messages within he context to go to the wrong place
> causing asserts in both child and parent.
>

That's correct - the Python bindings protect you a little bit, because
Context.term and Socket.close are no-ops if the process has been forked (no
libzmq API will be called). But no 'real' methods, where you are asking for
something to actually happen, are protected for performance reasons.

-MinRK


> I'm experimenting with a way of terminating the inherited context in the
> child process (closing all sockets and pipes and terminating all zmq
> threads) but haven't managed to do it with out triggering an assert
> somewhere.
>
> The only thought I had was to use a parent with no zmq context and only
> create a context in a child so that there is never any inherited resources.
> This may not easily fit your use case though.
>
> Best,
> Matt
>
> > On 31 Aug 2013, at 4:36 am, MinRK <benjami...@gmail.com> wrote:
> >
> > You cannot continue to use zmq sockets after a fork - you have to take
> care in your application that no sockets created before the fork will be
> used by any calls in the child process.​
> > _______________________________________________
> > zeromq-dev mailing list
> > zeromq-dev@lists.zeromq.org
> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev@lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
_______________________________________________
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to