Uh oh!
There was an error while loading. Please reload this page.
Harden Worker task lifecycle cleanup - #1
Merged
Conversation
zekageri
marked this pull request as ready for review
July 27, 2026 09:08
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes Worker fully responsible for releasing completed one-shot and recurring jobs. Callers can use
once()as fire-and-forget without callingwaitFor()orclearFinished()to recover memory.Root cause
The previous lifecycle published
createdWithCapsafter task creation. A fast task could start before that write and select normalvTaskDelete()even though it was created with a PSRAM stack throughxTaskCreatePinnedToCoreWithCaps(). The lifecycle also markedtaskExitedbefore FreeRTOS deletion ran, retained completed records and callback captures until caller cleanup, and self-deleted capability tasks through ESP-IDF's temporary cleanup-task path.Changes
waitFor()callswaitFor()andstopAndWait()complete only after stack and TCB releasemaxConcurrentJobsso cleanup queue capacity is guaranteedclearFinished()only as a deprecated compatibility no-opCaller impact
Normal fire-and-forget usage requires no cleanup:
worker.once([](WorkerJobContext &) { runProbe(); });waitFor()remains available only when application logic needs synchronization with physical task cleanup.Validation
-Wall -Wextra -Werror, and-fno-exceptionsHardware verification
The updated
TaskCleanupSentinelperforms warmed ESP32 heap and task-count checks. Native ESP32-P4 execution is still required before treating the original Core memory leak as fully verified on hardware.