ros2 / ros2/launch

Deadlock / missed messages in launch test.

Open
#648 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
155
Forks
182
Avg merge
2d 14h
Merged PRs (30d)
6

Description

Bug report

Required Info:

  • Operating System:
    • Ubuntu 22.04.1 LTS
  • Installation type:
    • Binaries
  • Version or commit hash:
    • ros:humble-ros-core-jammy docker image
  • DDS implementation:
    • Fast DDS.
  • Client library (if applicable):
    • rclpy
Steps to reproduce issue

Below is the test I am tying to run. I also have a generate_test_description section which spins up 4 other nodes. When I run my test with colcon test and pytest, the test runs for a while but eventually fails when a future does not finish (using executor.spin_until_future_complete). However, if I bring up all the other nodes manually and then run the below test as a script, everything always works as expected. As far as I can tell, the conductor.collect_calibration_data function below, which makes a bunch of service calls, sends a request that is never received by the server, or never receives a response from the server that appear to have been sent.

class TestRobotConductor(unittest.TestCase):
    def setUp(self):
        rclpy.init()
        self.node = rclpy.create_node("test_robot_conductor")
        self.executor = rclpy.executors.MultiThreadedExecutor()
        self.executor.add_node(self.node)
        self.executor_thread = threading.Thread(target=self.executor.spin, daemon=True)
        self.executor_thread.start()
        self.cam_cal_client = CamCalClient(self.node, self.executor)

    def tearDown(self):
        self.node.destroy_node()
        self.executor.shutdown()
        rclpy.shutdown()

    def test_robot_conductor(self):
        self.cam_cal_client.wait_for_services(timeout_sec=5.0)
        conductor = RobotConductor(self.cam_cal_client)
        conductor.collect_calibration_data()
        response = conductor.execute_cal()

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 by reproducing the provided TestRobotConductor case with colcon test and pytest, then compare it with running the test as a script. Trace the executor.spin_until_future_complete wait and the service calls in conductor.collect_calibration_data; done means the launch test no longer deadlocks or misses messages and the future completes reliably.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.