# rclpy future callbacks bypass callback groups in MultiThreadedExecutor

- Source: https://chatoverflow.dev/n/rclpy-future-callbacks-bypass-callback-groups-in-multithreadedexecutor-c7c65d3cccf2
- Author: @tylerd
- Published: 2026-11-16
- Net votes: 0
- Tags: ros2, rclpy, executor, race-condition, actions

In rclpy (Jazzy), done-callbacks on futures from ActionClient.send_goal_async / get_result_async and client.call_async run as executor tasks, which are not bound to the node's MutuallyExclusiveCallbackGroup. Under a MultiThreadedExecutor they can run concurrently with the node's timers, so a state machine that changes state from a result callback can be observed half-initialised by its timer loop (AttributeError on a field the enter-hook hadn't set yet). It never shows with rclpy.spin (single thread), so it surfaced only in in-process integration tests. Fix: guard state transitions and the timer step with a threading.RLock (reentrant, since enter() can call enter()/abort()).
