Skip to content

feat: name the subscriber (node + topic) in the UDS send-drop warning… - #18

Open
benaliabderrahmane wants to merge 1 commit into
develfrom
fix/uds-drop-log-subscriber-name
Open

feat: name the subscriber (node + topic) in the UDS send-drop warning…#18
benaliabderrahmane wants to merge 1 commit into
develfrom
fix/uds-drop-log-subscriber-name

Conversation

@benaliabderrahmane

@benaliabderrahmane benaliabderrahmane commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Names the offending subscriber (fully-qualified node name + topic) in the UDS send-drop warning and clarifies that the byte count is the dropped message's size, not the buffer fill level. Before/after:

UDS send to '/tmp/ros2_uds/200/sub_1_159bd.sock' dropped: subscriber recv buffer full (89 bytes, errno=Resource temporarily unavailable). ...
UDS send to node '/test_ns/test_node' on topic '/pull_stress' (socket '/tmp/ros2_uds/200/sub_1_159bd.sock') dropped: subscriber recv queue full — dropped a 89-byte message (recv buf configured 48 MB, errno=Resource temporarily unavailable). ...

How

  • make_peer_label(ns, name, topic) in transport.cpp (unit-tested, incl. root-namespace collapse and null tolerance).
  • The publisher's copy-on-write cache holds CachedSubscriber {socket_path, label}; labels are built once per graph change inside refresh_subscribers, so the publish hot path still copies one refcount and never formats a string.
  • send_to gains an optional peer_label (default null). The three publisher fan-out paths supply it; request/response callers are unchanged.

Rebased and retargeted onto devel

Rewritten against current devel (single commit): the wake-side TRANSIENT_LOCAL replay this originally also patched in rmw_wait.cpp no longer exists (#60 made replay pull-based, so the wait path no longer sends), and the three cache-refresh sites it edited are now devel's single refresh_subscribers helper — the feature got smaller by landing after those changes.

Verified: 14/14 ctest in the jazzy container; the churn stress test triggers a real drop and prints the new labeled warning.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves slow-subscriber drop diagnostics for the Unix Domain Socket (UDS) transport by attaching a human-readable subscriber identity (fully-qualified node name + topic) to ENOBUFS/EAGAIN send-drop warnings, while keeping the publish hot path allocation-free by caching the formatted label on graph changes.

Changes:

  • Add make_peer_label() to format node '/ns/name' on topic '/topic' (with sensible null/root handling) and test coverage for it.
  • Extend the publisher subscriber cache from socket paths to {socket_path, label} entries and plumb labels into send_to() from publish and TRANSIENT_LOCAL replay paths.
  • Update the ENOBUFS/EAGAIN warning to clarify the dropped byte count and include the configured receive buffer size for reference.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
rmw_unix_socket_cpp/test/test_transport.cpp Adds unit tests validating peer label formatting edge cases.
rmw_unix_socket_cpp/src/types.hpp Introduces CachedSubscriber and updates publisher cache to store {path,label} entries.
rmw_unix_socket_cpp/src/transport.hpp Extends send_to() with optional peer_label and declares make_peer_label().
rmw_unix_socket_cpp/src/transport.cpp Implements make_peer_label() and improves ENOBUFS/EAGAIN drop warning content.
rmw_unix_socket_cpp/src/rmw_wait.cpp Populates and uses cached subscriber labels for TRANSIENT_LOCAL replay sends.
rmw_unix_socket_cpp/src/rmw_publisher.cpp Populates and uses cached subscriber labels for publish and replay sends.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +190 to +194
"UDS send to %s (socket '%s') dropped: subscriber recv queue full — "
"dropped a %zu-byte message (recv buf configured %d MB, errno=%s). "
"Slow subscriber or undersized SO_RCVBUF.",
dest_path.c_str(), total, std::strerror(err));
peer_label ? peer_label : "peer", dest_path.c_str(), total,
RECV_BUF_SIZE / (1024 * 1024), std::strerror(err));
Comment on lines +54 to +56
// "node '/ns/name' on topic '/topic'". Null/empty fields are omitted; a "/"
// (root) namespace collapses to a single leading slash (ROS fully-qualified
// name), so ("/", "name", ...) yields "/name" rather than "//name".
Copilot AI review requested due to automatic review settings August 19, 2026 13:02
@benaliabderrahmane
benaliabderrahmane force-pushed the fix/uds-drop-log-subscriber-name branch from 5b2d46d to 78d25aa Compare August 19, 2026 13:02
@benaliabderrahmane
benaliabderrahmane changed the base branch from main to devel August 19, 2026 13:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

Suppressed comments (1)

rmw_unix_socket_cpp/src/transport.cpp:196

  • The drop warning reports total = sizeof(WireHeader) + payload_size, but the message text says “dropped a %zu-byte message”, which reads like the serialized ROS message size. Either log payload_size instead, or clarify that the count is the on-wire datagram size (incl. header) to avoid confusion when users compare against their message size.
        "UDS send to %s (socket '%s') dropped: subscriber recv queue full — "
        "dropped a %zu-byte message (recv buf configured %d MB, errno=%s). "
        "Slow subscriber or undersized SO_RCVBUF.",
        peer_label ? peer_label : "peer", dest_path.c_str(), total,
        RECV_BUF_SIZE / (1024 * 1024), std::strerror(err));

… and clarify the byte count

The drop warning printed only the peer's socket path and worded the
message size as if it were the receive-buffer fill level
("recv buffer full (N bytes)"). Both made a slow-subscriber drop hard
to diagnose: the path only encodes a PID, and the byte count looked
like it contradicted the configured buffer size.

Now the ENOBUFS/EAGAIN branch names the offending subscriber by its
fully-qualified node name and topic, states plainly that the number is
the dropped message's size, and shows the configured recv-buffer size
for reference.

The peer label is built once per graph change (in refresh_subscribers,
off the hot path) and stored in the copy-on-write subscriber cache
alongside the socket path, so the publish hot path still copies just a
refcount and never formats a string. send_to takes an optional
peer_label; the three publisher fan-out paths supply it,
request/response callers pass none and are unaffected.

Rewritten against current devel: the wake-side TRANSIENT_LOCAL replay
this originally also touched in rmw_wait.cpp no longer exists (#60's
pull-based replay), and the three cache-refresh sites it edited are now
the single refresh_subscribers helper.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants