Skip to content

S24.15: FreeRTOS BDD-target teardown handshake (drop fixed-sleep mutex destroy) #478

Description

@DavidCozens

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    storyStory issue

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions