Repository navigation
fix(rtps): ActionClient::wait_for_server() also waits for the feedback writer - #963
Conversation
…k writer typed_action_alignment kept failing on the Jazzy interop runner the same way after #939: the first goal succeeds, its one feedback sample never arrives ("feedback {-1, -1}"). #939 made the test wait until the SERVER's feedback writer has matched the client's reader. The other half was still open: the CLIENT's feedback reader may not have matched the server's writer yet when that sample arrives, and a reader drops a sample from a writer it does not know. wait_for_server() covered the three services only, while rcl_action_server_is_available() (what rclcpp_action's wait_for_action_server() polls) also requires a publisher matched to the client's feedback subscription. ActionClient::server_count() - and so wait_for_server() - now also counts the writers matched to the client's feedback reader. The test asserts it after wait_for_server() and keeps the server-side wait (a volatile writer only sends to readers it has matched; nothing on the client side can see that, rclcpp has the same window). Docs (header, Python docstring and the regenerated stub, rtps_rmi_ami.rst) say so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DFjjnq3XCTRAXENSxsCxJU
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
4 open issues
The comment is a bit inaccurate/misleading in two ways: (1) the “volatile” property is typically… · Newrtps::rpc::action_feedback_topic(impl_->action)is computed on everyserver_count()call, and… · New The last clause (“is not dropped by a reader that does not know the writer yet”) is slightly… · New This stub docstring line is very long and may violate style/lint rules and harms readability in… · New
What changed in this PR
Ensures ActionClient::wait_for_server() waits for the feedback data path to be discoverable end-to-end to avoid dropping the first (often only) feedback sample in fast goals during interop runs.
Changes:
- Extend
ActionClient::server_count()/wait_for_server()to include matched writers on the feedback topic. - Strengthen
typed_action_alignmentby asserting client-side feedback writer match afterwait_for_server(). - Update documentation (C++ header, Python bindings/stubs, RST protocol doc) to reflect the new wait semantics.
| File | Description |
|---|---|
| pc/tests/rtps_typed_action_alignment.cpp | Adds an assertion that wait_for_server() covers feedback writer matching and preserves server-side match wait. |
| lib/python_bindings/rtps_bindings.cpp | Updates Python docstring to reflect feedback-topic matching in server_count(). |
| lib/python_bindings/espp/_espp/__init__.pyi | Regenerates stub docstring to include feedback topic matching. |
| doc/en/protocols/rtps_rmi_ami.rst | Documents that wait_for_server() also waits for feedback writer matching to prevent first-feedback loss. |
| components/rtps/src/rtps_participant.cpp | Implements feedback-writer matching in ActionClient::server_count(). |
| components/rtps/include/rtps_participant.hpp | Updates C++ API docs for server_count() and wait_for_server() to include feedback matching. |
Review effort: Lite
- the feedback topic name is built once (ActionClient::Impl::feedback_topic) instead of on every server_count() call, which wait_for_server() polls; - the comment and the RMI / AMI doc say why the first feedback was lost: the client's reader drops samples from a writer it has not discovered and matched yet, and the volatile feedback topic does not resend them (rcl also checks the status topic; this client subscribes to feedback only); - the Python docstring of ActionClient.server_count wraps (the stub is regenerated from the built module). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DFjjnq3XCTRAXENSxsCxJU
|
✅Static analysis result - no issues found! ✅ |
rtps memory footprint (QEMU, esp32)Deltas in parentheses are against main @ 829c8fd (run 46688952857): a bigger size or a smaller free heap than the baseline's is a cost of this change. librtps.a in the image (bytes,
|
| embedded | host | host_large | |
|---|---|---|---|
| flash code | 162,127 (-95) | 163,485 (-103) | 163,897 (-95) |
| flash data | 1,272 (+0) | 1,272 (+0) | 1,272 (+0) |
| DRAM (.data + .bss) | 126 (+0) | 126 (+0) | 126 (+0) |
| IRAM | 0 (+0) | 0 (+0) | 0 (+0) |
engine objects, sizeof (bytes; the Domain is allocated from the heap at start())
| object | embedded | host | host_large |
|---|---|---|---|
| rtps::Domain (holds every pool below) | 99,208 (+0) | 569,968 (+0) | 3,156,208 (+0) |
| rtps::Participant | 34,304 (+0) | 42,736 (+0) | 52,720 (+0) |
| rtps::StatefulWriter | 2,528 (+0) | 2,960 (+0) | 6,416 (+0) |
| rtps::StatelessWriter | 1,872 (+0) | 2,256 (+0) | 3,792 (+0) |
| rtps::StatefulReader | 1,968 (+0) | 2,008 (+0) | 2,104 (+0) |
| rtps::StatelessReader | 1,960 (+0) | 2,000 (+0) | 2,096 (+0) |
| espp::RtpsParticipant | 608 (+0) | 608 (+0) | 608 (+0) |
embedded: heap by stage (free bytes; a cost is a negative delta)
| stage | internal | delta | internal low-water mark | largest internal block | PSRAM | delta |
|---|---|---|---|---|---|---|
| boot | 220,279 (+0) | 219,552 (+0) | 131,072 | 4,191,440 (+0) | ||
| started | 159,843 (-160) | -60,436 | 159,272 (-100) | 73,728 | 4,090,208 (+0) | -101,232 |
| endpoints | 139,503 (-8) | -20,340 | 138,128 (-8) | 69,632 | 4,090,208 (+0) | +0 |
embedded: heap after each host-driven step (free bytes; deltas against the previous row; the pools are preallocated, so a peer costs little heap - the low-water mark shows the transients)
| step | internal | delta | internal low-water mark | largest internal block | PSRAM | delta |
|---|---|---|---|---|---|---|
| baseline | 133,255 (+8) | 132,168 (+4) | 69,632 | 4,090,228 (+12) | ||
| +1 remote participant (no match) | 133,139 (+20) | -116 | 130,440 (-460) | 69,632 | 4,090,228 (+0) | +0 |
| +1 more remote participant (no match) | 133,111 (+8) | -28 | 130,440 (-460) | 69,632 | 4,090,228 (+0) | +0 |
| +1 remote participant with a matched publisher | 133,091 (+8) | -20 | 130,440 (-460) | 69,632 | 4,090,228 (+0) | +0 |
| after a service call | 133,075 (+4) | -16 | 130,440 (-460) | 69,632 | 4,090,228 (+0) | +0 |
| after an action goal | 131,867 (-12) | -1,208 | 130,192 (-48) | 69,632 | 4,090,228 (+0) | +0 |
| after one 30 KB sample | 131,871 (-8) | +4 | 129,848 (-8) | 69,632 | 4,060,016 (+0) | -30,212 |
| all peers gone | 131,855 (-24) | -16 | 129,848 (-8) | 69,632 | 4,060,016 (+0) | +0 |
host: heap by stage (free bytes; a cost is a negative delta)
| stage | internal | delta | internal low-water mark | largest internal block | PSRAM | delta |
|---|---|---|---|---|---|---|
| boot | 219,047 (+0) | 218,320 (+0) | 131,072 | 4,191,440 (+0) | ||
| started | 130,575 (-20) | -88,472 | 129,980 (+0) | 69,632 | 3,617,120 (+12) | -574,320 |
| endpoints | 109,775 (-136) | -20,800 | 108,400 (-136) | 69,632 | 3,617,120 (+12) | +0 |
host_large: the participant did not start on this target - the profile does not fit (panicked while the engine was being built - internal RAM exhausted building the Domain's mutexes (the first error logged: [RtpsTransport/E][3.007]: Failed to create valid UDP socket for port 7401)); its sizeof is in the table above, the boot heap below
host_large: heap by stage (free bytes; a cost is a negative delta)
| stage | internal | delta | internal low-water mark | largest internal block | PSRAM | delta |
|---|---|---|---|---|---|---|
| boot | 219,047 (+0) | 218,320 (+0) | 131,072 | 4,191,440 (+0) | ||
| started | n/a | |||||
| endpoints | n/a |
The QEMU memory suite on 7b55f23 (run); the full numbers are the run's rtps-memory artifact.


Summary
typed_action_alignmentkept failing on the Jazzy interop runner after #939, in the same way. The first goal succeeds, but its one feedback sample never arrives:(run 46583796982, on #959, which only touched the Python bindings).
Root cause
#939 made the test wait until the server's feedback writer has matched the client's reader. The other half of the match was still open: the client's feedback reader may not have matched the server's writer when the sample arrives, and a reader drops samples from a writer it doesn't know yet. The goal finishes in milliseconds, so that one sample was the only chance.
ActionClient::wait_for_server()waited for the three services only.rcl_action_server_is_available(), which rclcpp_action'swait_for_action_server()polls, also requires a publisher matched to the client's feedback subscription.Change
ActionClient::server_count(), and sowait_for_server(), now also counts the writers matched to the client's feedback reader. espp's action client has no status subscription, so feedback is the one topic to add.client.matched_writers(feedback_topic) >= 1afterwait_for_server(). It keeps test(rtps): typed_action_alignment waits for the feedback reader to match #939's server-side wait, because a volatile writer only sends to readers it has matched. Nothing on the client side can observe that, and rclcpp has the same window.generate_stubs.py --checkpasses).rtps_rmi_ami.rstgets a short note too.Test plan
typed_action_alignmentlocally (macOS, Release, asrun_interop.shbuilds it). The race doesn't reproduce here: before the fix, 0 of 100 runs idle and 0 of 200 under CPU load (2 × ncpu spinners) failed. After the fix, 0 of 200 failed. CI's Jazzy interop is where it showed up, roughly once in several runs.rtps_action_*(cancel codes, goal flood, long goal, loopback, naming, types, worker pool) andrtps_rpc_*(empty reply, pending eviction, stop race).rtps_bindings_smoke,rtps_bindings_misuse_test,rtps_rpc_timeouts_test,rtps_task_configs_test,typing_api_test.🤖 Generated with Claude Code
https://claude.ai/code/session_01DFjjnq3XCTRAXENSxsCxJU