From 7bc8abd8be4eb8a80620c0a0fa519474238e1a03 Mon Sep 17 00:00:00 2001 From: Ramon Roche Date: Mon, 28 Sep 2026 11:19:37 -0700 Subject: [PATCH] test(ekf2): init the hrt in EKF2SelectorTest The test starts the hrt worker without hrt_init(), so the callout lock stays a default non-recursive mutex and the worker deadlocks on its own nested lock in hrt_tim_isr() -> hrt_call_invoke() the first time a tick fires. The selector's 10 ms backup reschedule normally keeps pushing the tick out, so it only fires when Run() pauses under load or in the slower Coverage build, where it hangs the test until the ctest timeout. VehicleAirDataTest and VehicleMagnetometerTest already do this. Refs #28862 Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Ramon Roche (cherry picked from commit 2ce73120bd47557027adb6475dacaab8fca9bf52) --- src/modules/ekf2/EKF2SelectorTest.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/modules/ekf2/EKF2SelectorTest.cpp b/src/modules/ekf2/EKF2SelectorTest.cpp index ce0f5b56c93..7d618d0c492 100644 --- a/src/modules/ekf2/EKF2SelectorTest.cpp +++ b/src/modules/ekf2/EKF2SelectorTest.cpp @@ -42,6 +42,7 @@ #include "EKF2Selector.hpp" +#include #include #include #include @@ -90,7 +91,11 @@ public: if (!wq_manager_started) { // the gtest harness starts no platform threads: the hrt callout // worker must exist before the selector's delayed self-scheduling - // runs, or the work queue blocks on an uninitialized semaphore + // runs, or the work queue blocks on an uninitialized semaphore. + // Without hrt_init() the callout lock is not recursive, so the + // worker deadlocks on its own nested lock the first time a + // callout is due + hrt_init(); hrt_work_queue_init(); ASSERT_EQ(px4::WorkQueueManagerStart(), 0); wq_manager_started = true;