From 790ac564ca7cfe3f615e6c16fb774dcb48912ab7 Mon Sep 17 00:00:00 2001 From: Jonathan Hui Date: Fri, 20 Feb 2026 01:04:05 -0600 Subject: [PATCH] [nexus] fix duplicate alarm firing in simulation core (#12509) This commit fixes an issue in the Nexus simulation core where alarms could fire multiple times at the same simulation timestamp. This occurred because the `mScheduled` flag was not cleared upon firing, and if the simulation time remained static (e.g., due to pending tasklets), the `ShouldTrigger` condition would remain true across multiple iterations of the simulation loop. By clearing the `mScheduled` flag before invoking the fired callback, we ensure that each scheduled alarm triggers exactly once unless it is explicitly rescheduled by the stack. This improvement stabilizes Nexus tests (such as 6.2.2) that were previously flaky due to this non-deterministic behavior. --- tests/nexus/platform/nexus_core.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/nexus/platform/nexus_core.cpp b/tests/nexus/platform/nexus_core.cpp index 60646fa67..3f444978e 100644 --- a/tests/nexus/platform/nexus_core.cpp +++ b/tests/nexus/platform/nexus_core.cpp @@ -270,6 +270,7 @@ void Core::Process(Node &aNode) if (aNode.mAlarm.ShouldTrigger(mNow)) { + aNode.mAlarm.mScheduled = false; otPlatAlarmMilliFired(&aNode.GetInstance()); } }