ros2 / ros2/ros2cli

`ros2 node list --spin-time` inconsistent behavior if daemon is started or stopped

Open
#164 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

backlog bug
Dominant language
Python
Stars
262
Forks
228
Avg merge
23h 15m
Merged PRs (30d)
12

Description

Bug report

Required Info:

  • Operating System:
    • Ubuntu Bionic
  • Installation type:
    • debs
  • Version or commit hash:
    • crystal pre-release
  • DDS implementation:
    • Fast-RTPS
  • Client library (if applicable):
    • N/A
Steps to reproduce issue

Time how long it takes to list nodes with --spin-time and the daemon stopped

ros2 daemon stop
time ros2 node list --spin-time 15

Repeat with the daemon started

ros2 daemon start
time ros2 node list --spin-time 15
Expected behavior

ros2 node list --spin-time 15 would always take about 15 seconds to complete

Actual behavior

With the daemon stopped it takes the expected time

$ ros2 daemon stop
The daemon has been stopped
$ time ros2 node list --spin-time 15

real    0m15.336s
user    0m0.284s
sys     0m0.056s

With the daemon started it completes very quickly

$ ros2 daemon start
The daemon is already running
$ time ros2 node list --spin-time 15

real    0m0.322s
user    0m0.280s
sys     0m0.040s
Additional information

There are two stragegies: direct and daemon.
https://github.com/ros2/ros2cli/blob/af65db2d95fbbd436308d7fd363c6545342496ad/ros2cli/ros2cli/node/strategy.py#L26-L30

DirectNode checks spin_time
https://github.com/ros2/ros2cli/blob/af65db2d95fbbd436308d7fd363c6545342496ad/ros2cli/ros2cli/node/direct.py#L39-L43

DaemonNode does not. It would need to check spin time and spin before calling get_node_names_and_types()

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ros2cli/ros2cli/node/strategy.py and compare DirectNode in ros2cli/ros2cli/node/direct.py with DaemonNode. Reproduce the behavior using ros2 daemon stop and ros2 daemon start, then verify that ros2 node list --spin-time 15 behaves consistently in both cases. Done means the daemon path observes the requested spin time before retrieving node names and types.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.