Skip to content

Include localhost in ros2 doctor hello connectivity checks - #1269

Open
sylvesterkaczmarek wants to merge 2 commits into
ros2:rollingfrom
sylvesterkaczmarek:fix-1077-localhost-connectivity
Open

Include localhost in ros2 doctor hello connectivity checks#1269
sylvesterkaczmarek wants to merge 2 commits into
ros2:rollingfrom
sylvesterkaczmarek:fix-1077-localhost-connectivity

Conversation

@sylvesterkaczmarek

@sylvesterkaczmarek sylvesterkaczmarek commented Aug 20, 2026

Copy link
Copy Markdown

Summary

Addresses the localhost-connectivity part of #1077.

ros2 doctor hello currently excludes messages originating from the same hostname, so it cannot validate local topic delivery or multicast loopback. Count those messages as well so the command reports single-host connectivity.

The UDP receiver shutdown path now uses a per-instance socket pair instead of sending a wake-up datagram to the shared UDP port, so one ros2 doctor hello instance cannot wake or contaminate another instance on the same host. In --once mode, the command waits with a bounded timeout for the local topic and multicast round-trip instead of assuming both complete within one 0.1-second emit period.

The existing single-host CLI test now expects one local topic subscription and one local multicast receive.

Testing

  • Updated the existing single-host test expectations
  • Branch is one signed commit and two files ahead of Rolling
  • Full platform/RMW integration testing is left to project CI

Did you use Generative AI?

Yes. AI was used to assist with tests.

Count local topic and multicast communication so `ros2 doctor hello` can validate connectivity on a single host. Ignore the internal UDP wake-up packet used during receiver shutdown.

Signed-off-by: Sylvester Kaczmarek <16242628+sylvesterkaczmarek@users.noreply.github.com>
@mergify

mergify Bot commented Aug 20, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@fujitatomoya fujitatomoya left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@sylvesterkaczmarek thanks for creating PR.

i assume you are using AI agent to create this PR, that is fine. but we have AI guideline: https://discourse.openrobotics.org/t/guidelines-for-ai-assisted-contributions-in-the-ros-project/55903 and please use our PR template to disclose the AI tools.

Comment thread ros2doctor/ros2doctor/verb/hello.py Outdated
Comment on lines +225 to +226
if self._is_shutdown:
break

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

how does it guarantee that is come from the same instance shutdown though? guessing this is flaky and can leak into other instances on the same host?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good point. The shared UDP wake-up could be delivered to another receiver bound to the same port. I replaced it with a per-instance socket.socketpair() used only to wake that receiver thread, so shutdown signaling can no longer leak into another ros2 doctor hello instance.

hello_verb = HelloVerb()
hello_verb.main(args=args, summary_table=summary)
expected_summary = _generate_expected_summary_table()
expected_summary = _generate_expected_summary_table(hostname)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

with PR, the following assertion is only correct if two independent round-trips both complete within roughly that one 0.1-second window, i suggest that is tough and this is gonna be flaky test.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Agreed. I removed the 0.1-second timing assumption. In --once mode the command now waits, with a bounded 5-second timeout, for both the local topic subscription and multicast receive before producing the summary.

Use a per-instance socket pair to wake the multicast receiver without leaking shutdown traffic to other ros2 doctor instances, and wait deterministically for the local topic and multicast round-trip in --once mode.

Signed-off-by: Sylvester Kaczmarek <16242628+sylvesterkaczmarek@users.noreply.github.com>
@sylvesterkaczmarek
sylvesterkaczmarek force-pushed the fix-1077-localhost-connectivity branch from ef9512d to 53a34f4 Compare August 20, 2026 12:41
@fujitatomoya

Copy link
Copy Markdown
Collaborator

@sylvesterkaczmarek thanks for fixing up, out of curiosity what kind of AI models and tools are used to generate this code?

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