Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lock around Tracker creation and destruction #667

Merged
merged 1 commit into from
Aug 20, 2024

Conversation

godlygeek
Copy link
Contributor

@godlygeek godlygeek commented Aug 20, 2024

The Tracker.__enter__ and Tracker.__exit methods may wind up releasing the GIL, which allows another thread to see an intermediate state where the tracker is not fully installed. Add a lock, shared across all trackers, to serialize access to the global state that tracker installation and uninstallation writes to.

Closes #665

@godlygeek godlygeek force-pushed the lock_around_tracker_creation branch from c4544c7 to 05b89f9 Compare August 20, 2024 00:45
The `Tracker.__enter__` and `Tracker.__exit` methods may wind up
releasing the GIL, which allows another thread to see an intermediate
state where the tracker is not fully installed. Add a lock, shared
across all trackers, to serialize access to the global state that
tracker installation and uninstallation writes to.

Signed-off-by: Matt Wozniski <[email protected]>
@godlygeek godlygeek force-pushed the lock_around_tracker_creation branch from 05b89f9 to 74073e1 Compare August 20, 2024 00:47
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.94%. Comparing base (f848fc3) to head (74073e1).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #667      +/-   ##
==========================================
- Coverage   93.03%   92.94%   -0.10%     
==========================================
  Files          94       94              
  Lines       11445    11445              
  Branches     2114     2114              
==========================================
- Hits        10648    10637      -11     
- Misses        797      808      +11     
Flag Coverage Δ
cpp 92.94% <ø> (-0.10%) ⬇️
python_and_cython 92.94% <ø> (-0.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pablogsal pablogsal merged commit 29daff6 into bloomberg:main Aug 20, 2024
14 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

using memray with flask and then TypeError: 'memray._memray.ProfileFunctionGuard' object is not callable
3 participants