-
Notifications
You must be signed in to change notification settings - Fork 257
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
While playing, the last recorded message cannot be sent if the size of the message is big. #571
Comments
After checking, the cause is rosbag2/rosbag2_transport/src/rosbag2_transport/rosbag2_transport.cpp Lines 96 to 107 in 0c1ea6a
Publisher is created and saved in rosbag2/rosbag2_transport/src/rosbag2_transport/player.cpp Lines 191 to 205 in 0c1ea6a
Since sending a message is asynchronous, while the message is bigger, sending all messages will spend much time. If modify codes as below, all recorded messages can be sent in my case.
Of course, this isn't the correct solution. |
@adamdbrw do you see a similar behavior during your performance evaluation? |
We didn't notice such behavior, but also our evaluation was almost completely focused on recording (for various reasons explained earlier). This looks like we need to wait for confirmation of successful sending of last message before we exit destructor. I don't mind fixing this as long as all interested parties agree. |
Do you have any idea on how to check all message sending ? |
I would start with checking whether the publish is called at all for the last message - this can be easily debugged |
Share my check information. rosbag2/rosbag2_transport/src/rosbag2_transport/player.cpp Lines 181 to 189 in c38630b
|
I wonder - do you see this behavior across all 3 standard RMW implementations, or just with FastDDS? |
Sorry for late reply. I tried cyclonedds and rti connext. This problem doesn't occur for these DDS. |
@Barry-Xu-2018 the difference is likely because only FastDDS writer (for publishing) is asynchronous by default. While this issue should of course be resolved (we should wait in some way), you can also easily set FastDDS to use synchronous writing. This is described here https://discourse.ros.org/t/rmw-fast-dds-publication-mode-sync-vs-async-and-how-to-change-it/17153. |
Thank you for your information. I am interesting in how to fix this issue with asynchronous. But now I have no good idea. |
Hi @Barry-Xu-2018, Here you have an API, you could use: wait_for_all_acked And here you have how to expose the publisher to call this API: https://github.com/ros2/demos/blob/master/demo_nodes_cpp_native/src/talker.cpp |
Really appreciate your information. |
The wait_for_acknowledgments is part of the DDS Standard, both Fast DDS and RTI Connext DDS implement this Publisher/DataWriter method. I think this use case justifies to expose the method through the RCL |
Hi @JaimeMartin
Totally agree. |
We can guide you through the process of exposing this method, it should be straightforward. |
Hi @JaimeMartin
Thank your very much for your support. |
Hi everyone, I think exposing It is indeed a very useful feature, no only for this particular use case, but also in general (for example for synchronizing publisher and subscription operations based on a command topic). As a side note, in synchronous delivery you could experience the same behaviour if the message is lost somewhere in the network stack, so even in that case, you'd want to wait for the acknowledgement. |
I have created a issue in RMW ros2/rmw#295 to expose this interface |
@Barry-Xu-2018 all of the interfaces and APIs have been merged in mainline. would you mind taking care of this as well? probably we can provide the option via |
Okay. I will make a fix.
Yeah. It is better to be an option for user. |
It looks like this is closed by #951 (please reopen if that is not the case). By the way, yes, the option seems like a good idea to me. Good work 👍 |
Description
While playing, the last recorded message cannot be sent if the size of the message is big
Expected Behavior
Recorded messages all be sent while playing
Actual Behavior
The last recorded message cannot be sent successfully
To Reproduce
Make publisher and the size of message is bigger than 512KB.
Execute publisher
In another terminal, execute
Wait for a while, and do
ctrl+c
to terminate record.Check the number of record by below command
At item
Messages:
, you will get the number of message recorded.Play recorded message
Start subscriber and execute below command in another terminal
You will find the number of received message is less than recorded message.
If print the sequence of message, you will find the last one isn't received in subscriber.
System (please complete the following information)
Additional context
If you cannot reproduce this on your environment, you can increase the size of the message (such 2MB).
The text was updated successfully, but these errors were encountered: