Closed
Description
Bug report
fi_freelist
isn't thread-safe (move topycore_freelist.h
and follow that pattern)enter_task
,leave_task
, andswap_current_task
aren't thread-safe due to sharedstate->current_tasks
and borrowed references.register_task
andunregister_task
aren't thread-safe due to sharedstate->asyncio_tasks
linked list_asyncio_all_tasks_impl
isn't thread-safe due the theasyncio_tasks
linked list.
For 2, 3, and 4, we can consider using critical sections to protect the accesses to state->current_tasks
and state->asyncio_tasks
.
Longer term, moving data to per-loop will probably help with multi-threaded scaling.
Linked PRs
- gh-120974: Use common freelist code in asyncio #122132
- gh-120974: Make _asyncio._enter_task atomic in the free-threaded build #122138
- gh-120974: Make _asyncio._leave_task atomic in the free-threaded build #122139
- [3.13] gh-120974: Make _asyncio._enter_task atomic in the free-threaded build (GH-122138) #122152
- [3.13] gh-120974: Make _asyncio._leave_task atomic in the free-threaded build (GH-122139) #122186
- gh-120974: Make asyncio
swap_current_task
safe in free-threaded build #122317 - [3.13] gh-120974: Make asyncio
swap_current_task
safe in free-threaded build (GH-122317) #122612 - GH-120974: make _asyncio_all_tasks_impl thread safe #122801
Metadata
Metadata
Assignees
Projects
Status
Done