[zeromq-dev] czmq vs forked process

Kevin Sapper kevinsapper88 at gmail.com
Wed Dec 21 18:49:13 CET 2016


Hi Jay,

this is for you 
http://zguide.zeromq.org/page:all#Getting-the-Context-Right

//Kevin

On Mi, Dez 21, 2016 at 4:49 , Jay Rolette <rolette at infinite.io> wrote:
> I recently started using czmq and have run into a problem with the 
> global zmq context it uses when the process forks...
> 
> If the parent process does anything to cause the global context to be 
> created prior to forking, the child process is unable to send/recv 
> messages. That's not too surprising since zmq contexts aren't 
> shareable across processes, but I've been looking through the czmq 
> code for a way to destroy/recreate the global context in the child 
> process and not finding an obvious way to do that.
> 
> In older versions of czmq, it looks like I probably could have used 
> zctx_* calls to create a new context, but those were removed. Not 
> seeing anything similar in zsock_* or zsys_*.
> 
> Details about the behavior I'm seeing in the child process:
> 
> zmsg_send() returns success, but nothing is received on the server 
> side. On the client, the subsequent call to zmsg_recv() never returns.
> 
> This is on Ubuntu 14.04 LTS, czmq 4.0.1, libzmq 4.2 with pretty basic 
> REQ/REP sockets.
> 
> Is there anyway to stick with czmq for this or do I have to back off 
> to vanilla zmq?
> 
> Thanks,
> Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20161221/6adb1fac/attachment.htm>


More information about the zeromq-dev mailing list