Skip to content

callback execution rate is affected by declaration order, queue length, and executor #2912

@asherikov

Description

@asherikov

Generated by Generative AI

No response

Operating System:

Ubuntu 22.04

ROS version or commit hash:

humble

RMW implementation (if applicable):

rmw_fastrtps_cpp

RMW Configuration (if applicable):

No response

Client library (if applicable):

rclcpp

'ros2 doctor --report' output

Steps to reproduce issue

Scenario: two topic subscription callbacks, one of which is "heavy" -- takes more time to execute than the message publication rate. See demo https://github.com/asherikov/ros2_debug/blob/main/callback_order/src/subscriber.cpp.

Expected behavior

"Heavy" and "light" callbacks should be executed at 1:1 rate independently of declaration order, queue size, or the executor.

Actual behavior

When "heavy" subscription is defined before the "light" one with queue length=1, heavy callback is executed twice as frequent as the light one. Increasing the queue size or changing the declaration order brings the rate to the expected 1:1.

When multithreaded executor is used, the light callback is not called at all unless declared before the heavy one. Queue length has no effect. Presumably the same problem has been reported in #2702.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions