diff options
author | Damien George <damien@micropython.org> | 2025-05-12 13:18:33 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2025-05-16 13:31:34 +1000 |
commit | e1ab04e8205f78bb3ed9d0368bc1bb013b1bdcf9 (patch) | |
tree | 1764d158ad04c72e9430484701e56f73da1cf4c3 /docs/esp32 | |
parent | 9d565182d757e7a9bdf95bcb2b18fe2d6fa4111a (diff) | |
download | micropython-e1ab04e8205f78bb3ed9d0368bc1bb013b1bdcf9.tar.gz micropython-e1ab04e8205f78bb3ed9d0368bc1bb013b1bdcf9.zip |
esp32/mpthreadport: Fix double delete of tasks on soft reset.
Python threads (created via the `_thread` module) are backed by a FreeRTOS
task. Managing the deletion of the task can be tricky, and there are
currently some bugs with this in the esp32 port.
The actual crash seen was in FreeRTOS' `uxListRemove()`, and that's because
of two calls to `vTaskDelete()` for the same task: one in
`freertos_entry()` when the task ran to completion, and the other in
`mp_thread_deinit()`. The latter tried to delete the task a second time
because it was still in the linked list, because `vTaskPreDeletionHook()`
had not yet been called. And the reason `vTaskPreDeletionHook()` was yet
to be called is because the FreeRTOS idle task was starved.
This commit fixes that.
There are three things done by this commit:
- remove the `vTaskPreDeletionHook`, it's not needed anymore because task
stack memory is allocated by the IDF, not on the MicroPython heap
- when a task finishes it now removes itself from the linked list, just
before it deletes itself
- on soft reset, all tasks are deleted and removed from the linked list in
one swoop (while the mutex is held)
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'docs/esp32')
0 files changed, 0 insertions, 0 deletions