-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Closed
Labels
3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixestopic-asynciotopic-free-threadingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
fi_freelistisn't thread-safe (move topycore_freelist.hand follow that pattern)enter_task,leave_task, andswap_current_taskaren't thread-safe due to sharedstate->current_tasksand borrowed references.register_taskandunregister_taskaren't thread-safe due to sharedstate->asyncio_taskslinked list_asyncio_all_tasks_implisn't thread-safe due the theasyncio_taskslinked 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_tasksafe in free-threaded build #122317 - [3.13] gh-120974: Make asyncio
swap_current_tasksafe in free-threaded build (GH-122317) #122612 - GH-120974: make _asyncio_all_tasks_impl thread safe #122801
Metadata
Metadata
Assignees
Labels
3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixestopic-asynciotopic-free-threadingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
Status
Done