-
Notifications
You must be signed in to change notification settings - Fork 427
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(profiling): remove memalloc lock debug asserts (#12657)
We added some debug assertions around the locks we added to memalloc and the GIL. When we added the locks, we hadn't fully root-caused the problem and weren't 100% sure why we needed the locks in the first place. The assertions were there to find where the locks were contended, and to see if the GIL wasn't held. It turns out the GIL _was_ held, at least in a test program which crashed prior to adding locking. But we fundamentally misunderstood the guarantees the GIL made (or lack thereof). See https://cython.readthedocs.io/en/latest/src/userguide/nogil.html#don-t-use-the-gil-as-a-lock. The GIL is not intended to be used for anything other than protecting access to the interpreter. The GIL doesn't make critical sections for C extensions. The GIL isn't our lock, in other words. Since we understand better now why the locks are needed, we can remove the debug assertions. In their place, add some documentation for why the locks are needed.
- Loading branch information
Showing
4 changed files
with
18 additions
and
78 deletions.
There are no files selected for viewing
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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