Parent epic: #254 (E24: Code Hygiene)
Deferred from the PR #476 (S28.09) CodeRabbit review (finding #6). The lwIP target inherited this pattern from the merged FreeRTOS-Plus-TCP sibling, so it is not lwIP-specific — fix both targets together.
Problem
TeardownAll sets solidSyslogTeardown, waits a fixed vTaskDelay(pdMS_TO_TICKS(20)) hoping ServiceTask has observed the flag, then calls SolidSyslogFreeRtosMutex_Destroy(lifecycleMutex). The 20 ms is a guess: if ServiceTask has not yet reached its lock-check, the mutex is destroyed while that task can still lock/unlock it.
Bdd/Targets/FreeRtos/main.c (lines ~888–897)
Bdd/Targets/FreeRtosLwip/main.c (lines ~587)
Scope
Replace the fixed delay with an explicit handshake: after setting the teardown flag, block on a confirmation that ServiceTask has actually exited (task notification / "terminated" semaphore, or poll serviceTaskHandle becoming NULL with a bounded timeout) before destroying lifecycleMutex. Apply to both targets.
Acceptance
- No fixed-duration sleep guards the mutex destroy.
- Teardown waits on a real "service stopped" signal.
- Both FreeRTOS BDD targets' oracle lanes stay green.
Notes
Tier-3 BDD-target code; benign on the current QEMU runs (Service iterates every 1 ms, comfortably inside 20 ms) but a real race on slower/contended targets.
Parent epic: #254 (E24: Code Hygiene)
Deferred from the PR #476 (S28.09) CodeRabbit review (finding #6). The lwIP target inherited this pattern from the merged FreeRTOS-Plus-TCP sibling, so it is not lwIP-specific — fix both targets together.
Problem
TeardownAllsetssolidSyslogTeardown, waits a fixedvTaskDelay(pdMS_TO_TICKS(20))hopingServiceTaskhas observed the flag, then callsSolidSyslogFreeRtosMutex_Destroy(lifecycleMutex). The 20 ms is a guess: ifServiceTaskhas not yet reached its lock-check, the mutex is destroyed while that task can still lock/unlock it.Bdd/Targets/FreeRtos/main.c(lines ~888–897)Bdd/Targets/FreeRtosLwip/main.c(lines ~587)Scope
Replace the fixed delay with an explicit handshake: after setting the teardown flag, block on a confirmation that
ServiceTaskhas actually exited (task notification / "terminated" semaphore, or pollserviceTaskHandlebecoming NULL with a bounded timeout) before destroyinglifecycleMutex. Apply to both targets.Acceptance
Notes
Tier-3 BDD-target code; benign on the current QEMU runs (Service iterates every 1 ms, comfortably inside 20 ms) but a real race on slower/contended targets.