launch icon indicating copy to clipboard operation
launch copied to clipboard

Deadlock / missed messages in launch test.

Open rshanor opened this issue 2 years ago • 0 comments

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()

rshanor avatar Sep 02 '22 18:09 rshanor