-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
Closed
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
After recent changes, Polars debug builds, which integrate tracemalloc tracking, started experiencing deadlocks. Ripping out the tracemalloc integration fixed them (pola-rs/polars#21231). This started happening specifically when GitHub Actions switched to 3.12.9. I imagine this is due to the recent tracemalloc bug fixes.
No reproducer yet, but as a starting point:
- I am fairly certain this was not after doing
tracemalloc.start()
, since it happened in e.g. doctest runs that don't do that at all. - Polars in this mode would trace Rust allocations using
PyTraceMalloc_Track()
: https://github.com/pola-rs/polars/blob/f378b24aeaaa14a8e7dacb6b35103424e8b97f1c/py-polars/src/memory.rs#L53 - Polars is heavily multi-threaded, and tracemalloc memory tracking would happen both while holding GIL and not holding GIL.
So this suggests some mixture of GIL-holding and non-GIL holding threads calling PyTraceMalloc_Track()
and friends can cause deadlocks.
CPython versions tested on:
3.12
Operating systems tested on:
Linux
Metadata
Metadata
Assignees
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error