Laurent, Thanks for respond. Yes, I'm using a zloop as zmq event reactor. Actually what my program do:
1. Create ROUTER socket, generate UUID and use it as identity. 2. Create UDP zbeacon and publish ROUTER identity to broadcast over local network 3. Listen for other beacons anb if it found, add to remotes list, connect to remote ROUTER socket. 4. Send to all remotes in list messages that requests state of every remote. Requests differ from remote to remote, so I need to send a particular messasge to particular remote using an remote indentity. 5. If remote didn't respond it will be disconnected and removed from list. 6. Also others types of requests may be send to any remotes in list if needed. So, it is a similar to Freelance brokerless pattern I found in ZMQ guide - I tried to build distributed processing systems with autodiscovery. Not sure PUB-SUB is useful for this - I'm need to send particular message to particular peer, not to all peers. I can reproduce this issue with following way: 1. Start first router 2. Start second router 3. Its discovers each other and communicate as well If I stop second router - first didn't stuck But if I stop first router - second stuck. Moreover, I'm cheking ZMQ_POLLIN event state for socket right before sending something, but it stucks on zmsg_send. 2013/7/26 Laurent Alebarde <[email protected]> > Possibly you have requirements that makes you stick to a Router-Router > architecture. Otherwise, PUB-SUB is what you need. > > As far as I have understood libzmq, with a R-R and a peer that disconnects > as a normal behaviour, your messages will accumulate in the remaining node > and will not be dropped. > > For your specific blocking problem, have you tried with a poller ? > > Hope it helps (but I am only a 0MQ beginner). > > Cheers, > > > Laurent. > > > Le 25/07/2013 23:15, Yauheni Baltouski a écrit : > > Hi, > > I'm using czmq for building small router application, so I'm using > ROUTER-ROUTER > connection for dynamic connection and send/recv mesages over it. > > All looks like working fine (as it possible for R-to-R case :), but I'm > in stuck > with sending message when peer disconnected (it is expected behavior). > So I want to continue processing, but zmsg_send is blocked with such > backtrace: > > #0 0xb7fdd424 in __kernel_vsyscall () > #1 0xb7e89690 in __GI___poll (fds=0xbfffee18, nfds=1, timeout=-1) at > ../sysdeps/unix/sysv/linux/poll.c:87 > #2 0xb7f9b618 in zmq::signaler_t::wait (this=0x80529d0, timeout_=-1) at > signaler.cpp:145 > #3 0xb7f8f7e8 in zmq::mailbox_t::recv (this=0x80529a0, cmd_=0xbfffeeb0, > timeout_=-1) at mailbox.cpp:69 > #4 0xb7f9c85d in zmq::socket_base_t::process_commands (this=0x80527b8, > timeout_=-1, throttle_=false) > at socket_base.cpp:823 > #5 0xb7f9cab0 in zmq::socket_base_t::send (this=0x80527b8, > msg_=0x8077998, flags_=2) at socket_base.cpp:648 > #6 0xb7fae380 in s_sendmsg (s_=0x80527b8, msg_=0x8077998, flags_=2) at > zmq.cpp:337 > #7 0xb7fae44b in zmq_sendmsg (s_=0x80527b8, msg_=0x8077998, flags_=2) at > zmq.cpp:346 > #8 0xb7f5af50 in zframe_send (self_p=0xbffff00c, zocket=0x80527b8, > flags=1) at zframe.c:211 > #9 0xb7f5f6fe in zmsg_send (self_p=0xbffff048, zocket=0x80527b8) at > zmsg.c:133 > #10 0x0804a9e5 in getModuleList_event_item (key=0x805ce80 "605dd619", > item=0x805e3d8, arg=0x8050038) > at modrouter.c:193 > #11 0xb7f5c8ab in zhash_foreach (self=0x8050048, callback=0x804a780 > <getModuleList_event_item>, > argument=0x8050038) at zhash.c:446 > #12 0x0804aad5 in getModuleList_event (loop=0x805c398, item=0x0, > arg=0x8050038) at modrouter.c:215 > #13 0xb7f5eecd in zloop_start (self=0x805c398) at zloop.c:370 > #14 0x0804bc5c in main (argc=2, argv=0xbffff2c4) at modrouter.c:578 > > Can somebody tells me what's wrong and how to avoid it? May be I should > use > ZMQ_DONTWAIT flag, but it not implemented in CZMQ. > I want to send message independ of peer state, if it dead it should be > just dropped. > > Thanks! > > > _______________________________________________ > zeromq-dev mailing > [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
