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

Set our recursion guard in all hooks #433

Merged

Conversation

godlygeek
Copy link
Contributor

@godlygeek godlygeek commented Jul 29, 2023

This prevents reentrancy if one hooked function calls into another. For instance, the jemalloc implementation of malloc calls into mmap while holding a lock, and our mmap hook calls malloc, so we must prevent our mmap hook from running beneath our malloc hook.

Closes #336

@godlygeek godlygeek force-pushed the set_recursion_guard_in_all_hooks branch from 88579db to 741a25d Compare July 29, 2023 03:05
This prevents reentrancy if one hooked function calls into another.
For instance, the jemalloc implementation of `malloc` calls into `mmap`
while holding a lock, and our `mmap` hook calls `malloc`, so we must
prevent our `mmap` hook from running beneath our `malloc` hook.

Signed-off-by: Matt Wozniski <godlygeek@gmail.com>
@godlygeek godlygeek force-pushed the set_recursion_guard_in_all_hooks branch from 741a25d to 88c5853 Compare July 29, 2023 03:22
@codecov-commenter
Copy link

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.01% ⚠️

Comparison is base (a519a95) 91.72% compared to head (88c5853) 91.72%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #433      +/-   ##
==========================================
- Coverage   91.72%   91.72%   -0.01%     
==========================================
  Files          90       90              
  Lines       10503    10520      +17     
  Branches     1446     1446              
==========================================
+ Hits         9634     9649      +15     
- Misses        866      868       +2     
  Partials        3        3              
Flag Coverage Δ
cpp 85.19% <100.00%> (+0.01%) ⬆️
python_and_cython 95.18% <ø> (ø)

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

Files Changed Coverage Δ
src/memray/_memray/hooks.cpp 98.20% <100.00%> (+0.20%) ⬆️

... and 1 file with indirect coverage changes

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

@pablogsal pablogsal merged commit 9ac0989 into bloomberg:main Jul 29, 2023
33 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.

Native run on PyQt-WebEngine hangs with jemalloc
3 participants