Repository navigation
Conversation
TopicCache::forget_reliable_writer removed the Writer's received_reliably_before marker. reliable_before() then falls back to SequenceNumber::default() (1), so get_changes_in_range_reliable hid every sample from that Writer that the application had not taken yet: samples received in full, and samples withheld behind a missing one, which the comment says are no longer awaited. This loses data whenever a Writer leaves soon after writing, before the application takes the sample: e.g. a ROS 2 node that publishes once and exits. The sample has reached a matched Reader and is acknowledged, but is never delivered. Now the marker moves past the last sample still present, so all of them can be taken. The marker is dropped with the Writer's last sample, or at once when none is present, and a Writer that is matched again is treated as present. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a reliable Writer goes away,
Reader::remove_writer_proxycallsTopicCache::forget_reliable_writer, which removes the Writer'sreceived_reliably_beforemarker. With no marker,reliable_before()falls back toSequenceNumber::default(), which is 1. Soget_changes_in_range_reliablehides every sample from that Writer that the application has not taken yet:forget_reliable_writersays are no longer awaited, so they should be handed over.As a result, a sample can reach a matched reliable Reader, be acknowledged, and never be delivered. This happens whenever the Writer leaves before the application takes the sample, for example a ROS 2 node that publishes once and exits. We hit it in dora (dora-rs/dora#4213), which reads through ros2-client.
Measured on one host with Humble and Fast-DDS. Each trial starts a fresh dora subscriber and a fresh
rclpypublisher that publishes one message as soon as it sees the subscription, then exits. The application starts taking a few tens of ms after the subscription is created:A native
rclpysubscriber under the same conditions gets 16/16 with Fast-DDS.In each of the 3 trials that remain lost, the Reader had not matched the Writer when the DATA arrived: no ACKNACK from it to that Writer precedes the DATA. That is the discovery race, a separate issue. In all 21 received Fast-DDS trials, the Reader's first ACKNACK came 0.8–5 ms before the DATA.
In a packet capture of a trial lost on master, the DATA reaches the Reader about 5 ms after the Reader's preemptive ACKNACK, so the Writer is matched. The Writer is disposed 8 ms later, and
takenever returns the sample.Change
forget_reliable_writernow moves the marker past the last sample of that Writer still in the cache, so all of them can be taken, including withheld ones.mark_reliably_received_before) is no longer treated as departed.Tests
Three new
dds_cacheunit tests. The first two fail on master:received_samples_stay_readable_after_their_writer_is_forgotten: sample 1 is readable beforeforget_reliable_writerand must stay readable after it.withheld_samples_are_handed_over_when_their_writer_is_forgotten: samples 2 and 3, withheld behind a missing 1, are handed over.a_forgotten_writer_leaves_no_marker_once_its_samples_are_gone: once garbage collection removes the departed Writer's last sample, its marker is gone too.cargo test --libpasses.network::udp_sender::tests::unicast_socket_rejects_ipv6_destinationbinds a fixed port (11401) and occasionally fails when the tests run in parallel. That is pre-existing, and it passes alone.🤖 Generated with Claude Code