Drop of messages with History "keep all" but not with "keep last"
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- cpp
- Domain
- distributed-systems
Research direction
Start with the MinimalPublisher and MinimalSubscriber snippets in the issue, checking the mismatch between the comments and the KeepLast QoS used in both examples. Reproduce the delayed-subscriber case with 7,000 messages, then determine the applicable Fast RTPS queue limit and verify completion by explaining the retained-message count and the QoS values required.
Written by the indexing model from the issue text.
Description
I am creating a publisher and subscriber with QoS History "Keep all" and Durability "transient local".
If publisher publishes more than 5000 and messages, then I run the subscriber, to start listen, it will only capture last 5k messages and not all messages.
Now if I change the History to "keep last" and depth 50000, and if I do the same thing (starting subscriber after publishing 5000 messages), subscriber listen all the messages.
I want to know what the maximum queue depth allowed in fast rtps which can be adhered.
Publisher code:
#include
#include
#include
#include
#include "rclcpp/rclcpp.hpp"
#include "std_msgs/msg/int32.hpp"
using namespace std::chrono_literals;
class MinimalPublisher : public rclcpp::Node
{
public:
MinimalPublisher()
: Node("minimal_publisher"), count_(0)
{
// Set up QoS with history keep all, reliability reliable, and durability transient local
auto qos = rclcpp::QoS(rclcpp::KeepLast(50000))
.reliable()
.transient_local();
publisher_ = this->create_publisher<std_msgs::msg::Int32>("topic", qos);
timer_ = this->create_wall_timer(
200ms, std::bind(&MinimalPublisher::timer_callback, this)); // Changed to 200ms
}
private:
void timer_callback()
{
if (count_ >= 7000) {
rclcpp::shutdown(); // Stop publishing after 7000 messages
return;
}
auto message = std_msgs::msg::Int32();
message.data = count_;
RCLCPP_INFO(this->get_logger(), "Publishing: '%d'", message.data);
publisher_->publish(message);
count_++;
}
rclcpp::TimerBase::SharedPtr timer_;
rclcpp::Publisher<std_msgs::msg::Int32>::SharedPtr publisher_;
size_t count_;
};
int main(int argc, char * argv[])
{
rclcpp::init(argc, argv);
rclcpp::spin(std::make_shared());
rclcpp::shutdown();
return 0;
}
Subscriber code:
#include
#include "rclcpp/rclcpp.hpp"
#include "std_msgs/msg/int32.hpp"
using std::placeholders::_1;
class MinimalSubscriber : public rclcpp::Node
{
public:
MinimalSubscriber()
: Node("minimal_subscriber")
{
// Set up QoS with history keep all, reliability reliable, and durability transient local
auto qos = rclcpp::QoS(rclcpp::KeepLast(50000))
.reliable()
.transient_local();
subscription_ = this->create_subscription<std_msgs::msg::Int32>(
"/topic", qos, std::bind(&MinimalSubscriber::topic_callback, this, _1));
}
private:
void topic_callback(const std_msgs::msg::Int32::SharedPtr msg) const
{
RCLCPP_INFO(this->get_logger(), "I heard: '%d'", msg->data);
}
rclcpp::Subscription<std_msgs::msg::Int32>::SharedPtr subscription_;
};
int main(int argc, char * argv[])
{
rclcpp::init(argc, argv);
rclcpp::spin(std::make_shared());
rclcpp::shutdown();
return 0;
}
please change the QoS values in code as needed.
- Dominant language
- C
- Stars
- 121
- Forks
- 89
- Avg merge
- 17h 40m
- Merged PRs (30d)
- 3
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ros2/rmw
-
Delete ament_export_include_directories() and ament_export_libraries() callsMay be free again @EkenoSamson claimed this 62 days ago, and no pull request is open. Opengood first issue
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Use ament_cmake_ros_core::ament_ros_defaults instead of setting CMAKE_C_STANDARD or CMAKE_CXX_STANDARDPossibly taken @EkenoSamson claimed this 62 days ago. Opengood first issue
Difficulty 3/5 1-2 days Newbie friendliness 74/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 42/100
-
Service request timeouts missing in RCL → RMW interactionMay be free again @JEnoch claimed this 420 days ago, and no pull request is open. Openenhancement
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
libreswan/libreswan#3185 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
category:port-update
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 2 days
-
llvm:instcombine
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
llvm/llvm-project#246503 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day