-
Notifications
You must be signed in to change notification settings - Fork 770
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unexpected heartbeat behavior #19
Comments
Hi Liam, I've tested your example. What you are seeing is a normal behavior. I will try to explain it. Data are not been lost, but they are not been published. If you capture the returned value from write function, then you will see a lot of writings are failing. This is because writer history is full. Data is removed from the writer history when it is acknowledged by all readers. This acknowledge occurs when the writer sends a HEARTBEAT to notify what data it sent, and the reader respond with an ACK to notify what data it has. In your example you are sending data very fast. 1000 samples per second. The default heartbeat period is 3 seconds. In three seconds the writer is not sending the next heartbeat, then the readers don't acknowledge. As the writer history is 100, from 3000 samples written in 3 seconds, only 100 are really sent. There are two solutions:
/* Talker::init() */
...
pa.topic.resourceLimitsQos.allocated_samples = 100;
// 10 milliseconds period
pa.times.heartbeatPeriod.seconds = 0;
pa.times.heartbeatPeriod.fraction = 42949673;
pa.qos.m_reliability.kind = RELIABLE_RELIABILITY_QOS;
...
/* Listener::init() */
...
sa.qos.m_reliability.kind = RELIABLE_RELIABILITY_QOS;
// 10 milliseconds period
sa.times.heartbeatResponseDelay.seconds = 0;
sa.times.heartbeatResponseDelay.fraction = 42949673;
... |
@richiprosima thank you for the quick response, that makes sense. Does this mean that it's possible for subscribers with very long heartbeat intervals to prevent delivery of data to other subscribers on the same topic, by forcing the publisher's history to fill up? |
Hi Liam, The heartbeat period is a parameter on the publishing side, therefore is common for all the subscribers. You are right, a very long heartbeat period could fill your history if you are writing too fast. The solution is either increase your history buffer, either decrease the heartbeat period, or a combination of both. It depends on your use case. |
great - i had not seen that the default |
Given a trivial program like https://gist.github.com/liamstask/e76f07ed86d4345ac6ac (abbreviated not to include the headers, but let me know and I can send complete source), I see the following output:
The interval appears to correspond with the heartbeat period. i.e., if I adjust the
PublisherAttributes
for the talker to includepa.times.heartbeatPeriod.seconds = 5;
instead of the default 3 seconds, I see the reported interval change to approximately 5 seconds.I would not expect the heartbeat to affect the delivery of data packets in this way. Is this a bug, or do I have something misconfigured?
The text was updated successfully, but these errors were encountered: