fix(Networking,NTP): retry when timer callbacks fail to start their task

reconnectionTimerCallback and ntpSyncTimerCallback ignored xTaskCreate()'s
result. On a fragmented heap a single failure silently ended the WiFi
reconnect chain (one-shot timer) or skipped the NTP sync. Both now re-arm
their one-shot timer and retry next interval. Same failure mode as F-071;
documented under F-073.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-15 21:50:54 +03:00
co-authored by Claude Opus 5.5
parent c43d9ae11c
commit 009cefcb90
2 changed files with 11 additions and 2 deletions
+6 -1
View File
@@ -555,7 +555,12 @@ void Networking::networkReconnectTaskFn(void* param) {
void Networking::reconnectionTimerCallback(TimerHandle_t xTimer) { void Networking::reconnectionTimerCallback(TimerHandle_t xTimer) {
if (_instance) { if (_instance) {
xTaskCreate(networkReconnectTaskFn, "netRecon", 3072, _instance, 5, NULL); // If the task can't be created (fragmented heap), re-arm the one-shot
// timer to try again next interval. Before, a single failure ended the
// reconnect chain silently. No LOG here — Tmr Svc stack is 2KB.
if (xTaskCreate(networkReconnectTaskFn, "netRecon", 3072, _instance, 5, NULL) != pdPASS) {
xTimerStart(xTimer, 0);
}
} }
} }
+5 -1
View File
@@ -459,7 +459,11 @@ static void ntpSyncTask(void* param) {
// Non-blocking NTP sync timer callback — defers work to a task (Tmr Svc stack is only 2KB) // Non-blocking NTP sync timer callback — defers work to a task (Tmr Svc stack is only 2KB)
void ntpSyncTimerCallback(TimerHandle_t xTimer) { void ntpSyncTimerCallback(TimerHandle_t xTimer) {
xTaskCreate(ntpSyncTask, "ntpSync", 5120, NULL, 5, NULL); // Task creation can fail on a fragmented heap — re-arm the one-shot timer
// and retry in 3s instead of silently skipping the sync.
if (xTaskCreate(ntpSyncTask, "ntpSync", 5120, NULL, 5, NULL) != pdPASS) {
xTimerStart(xTimer, 0);
}
} }
#endif #endif