[zeromq-dev] Publishers stops sending data after sometime. Subscriber is required to fix publisher
Luca Boccassi
luca.boccassi at gmail.com
Sat Jan 27 16:02:49 CET 2018
I'm not sure if Windows has a working TCP Keepalive - you can try with
the heartbeats instead which are at the ZMQ layer, see ZMQ_HEARTBEAT_*
Also remember to set all these options BEFORE connect/bind or they
won't have any affect.
On Sat, 2018-01-27 at 13:51 +0000, Ravi Joshi via zeromq-dev wrote:
> Hi Tobias,
>
> Thank you very much. How to send lower heartbeats? Do we need to set
> it using setsockopt?
>
> By the way, at present following setsockopt are already set for all
> three subscribers-
>
>
> (1) ZMQ_SUBSCRIBE : Allow all messages
>
> (2) ZMQ_RCVTIMEO :1000 ms
> (3) ZMQ_LINGER :1
> (4) ZMQ_CONFLATE :1
> (5) ZMQ_TCP_KEEPALIVE :1
> -
> Thanks
> Ravi
>
>
> On Saturday, 27 January 2018 10:05 PM, Tobias Elbert <tobias_elbert at h
> otmail.com> wrote:
>
>
>
> Hi Ravi,
>
> I recall having had this problem a while ago, too, in another
> project. I was using C# clrzmq3 bindings on either side. I never
> solved it directly but from memory I recall sending down heartbeats
> and once a subscriber hadn't received a heartbeat message for X
> seconds, I restarted it.
>
>
> Cheers
> Tobias
>
>
>
> ________________________________
>
> From: zeromq-dev <zeromq-dev-bounces at lists.zeromq.org> on behalf of
> Ravi Joshi via zeromq-dev <zeromq-dev at lists.zeromq.org>
> Sent: Saturday, January 27, 2018 11:27 AM
> To: ZeroMQ development list
> Cc: Ravi Joshi
> Subject: Re: [zeromq-dev] Publishers stops sending data after
> sometime. Subscriber is required to fix publisher
>
> Hi Justin,
>
> I will check it using netstat.
>
> Meanwhile, ZMQ_TCP_KEEPALIVE seems not working. I still see that
> after some time, Windows OS, where publishers are running, is showing
> 0 MBPS transmission rate. After I restart subscribers in ROS on
> Ubuntu, publishers start working. Please note that during this
> process I am not restarting publishers at all.
>
> Below is the code snippet added to all subscribers-
>
> int tcp_keepalive = 1;
> zmq_socket.setsockopt(ZMQ_TCP_KEEPALIVE, &tcp_keepalive,
> sizeof(tcp_keepalive));
>
> -
> Thanks
> Ravi
>
>
>
> On Saturday, 27 January 2018 5:36 PM, Justin Karneges <justin at karnege
> s.com> wrote:
>
>
>
> One thing you might do is run netstat on both sides to see if the
> connections are still listed. In a dead connection scenario, netstat
> should no longer list the connection on the PUB side, but should
> remain listing it on the SUB side.
>
>
> Note that it can take time for the PUB connection to give up. On
> Linux, the default is something like 20 minutes after it dies, so
> give the PUB side some extra time after messages stop transmitting.
> If transmission hasn't worked for over 20 minutes and netstat is
> still showing the connection on the PUB side, then the problem may be
> something else.
>
>
> On Sat, Jan 27, 2018, at 12:13 AM, Ravi Joshi via zeromq-dev wrote:
>
> Hi Justin,
> >
> >
> >
> > Thank you very much. How do I make sure that I am getting dead
> > connections?
> >
> >
> >
> > For time being, I am enabling ZMQ_TCP_KEEPALIVE on all 3 SUB
> > sockets.
> >
> >
> >
> > I will tell you the status of it after sometime.
> >
> >
> >
> > Thanks
> >
> > -
> >
> > Ravi
> >
> > Sent from Yahoo Mail for iPhone
> >
> >
> >
> > On Saturday, January 27, 2018, 3:27 PM, Justin Karneges <justin at kar
> > neges.com> wrote:
> >
> > Hi,
> > >
> > >
> > >
> > > One issue with socket types that don't usually write data (such
> > > as SUB) is that a dead connection might go unnoticed forever. You
> > > can work around this by enabling TCP keep alives on the SUB
> > > socket. I don't know if you're getting dead connections here but
> > > just thought I'd mention it.
> > >
> > >
> > >
> > > Justin
> > >
> > >
> > >
> > > On Fri, Jan 26, 2018, at 9:33 PM, Ravi Joshi via zeromq-dev
> > > wrote:
> > >
> > > > Hi,
> > > >
> > > > I am using Publisher-Subscriber pattern consisting of 3
> > > > publishers to
> > > > publish 3 different types of data. All 3 publishers are written
> > > > in a
> > > > single C# file. However, each subscriber is written in a
> > > > separate C++
> > > > file inside ROS. From the point of ZeroMQ, there is no
> > > > difference in
> > > > each subscriber, since context, socket initialization and
> > > > receiving
> > > > message is done in the same way for all subscriber. Hence, in
> > > > order to
> > > > make the mail shorter, I am just posting code snippet of 1
> > > > subscriber below.
> > > >
> > > > The publisher code in C# snippet is available in Pastebin
> > > > (https://pastebin.com/S65LmwuV).
> > > > The subscriber code in C++ snippet is available in Pastebin
> > > > (https://pastebin.com/xb3V0n0u).
> > > >
> > > > The publisher works well initially for some time and
> > > > successfully
> > > > transmits data at 700MBPS rate but stops transmitting any data
> > > > after 5-6
> > > > hours.
> > > >
> > > > In order to make publisher working again, I need to restart
> > > > the
> > > > subscribers. This is strange to me since it is unexpected
> > > > behavior as
> > > > per the Publisher-Subscriber pattern is concerned.
> > > >
> > > > Why such weird behavior? Any workaround, please.
> > > >
> > > > -
> > > > Thanks
> > > > Ravi
> > > > _______________________________________________
> > > > zeromq-dev mailing list
> > > > zeromq-dev at lists.zeromq.org
> > > > https://lists.zeromq.org/mailman/listinfo/zeromq-dev
> > >
> > >
> > >
> > > _______________________________________________
> > >
> > > zeromq-dev mailing list
> > >
> > > zeromq-dev at lists.zeromq.org
> > >
> > > https://lists.zeromq.org/mailman/listinfo/zeromq-dev
> > >
> > >
> > > >
> >
> > _______________________________________________
> >
> > zeromq-dev mailing list
> >
> > zeromq-dev at lists.zeromq.org
> >
> > https://lists.zeromq.org/mailman/listinfo/zeromq-dev
> >
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> https://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> https://lists.zeromq.org/mailman/listinfo/zeromq-dev
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> https://lists.zeromq.org/mailman/listinfo/zeromq-dev
--
Kind regards,
Luca Boccassi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20180127/27548b8a/attachment.sig>
More information about the zeromq-dev
mailing list