-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Fix thread-safety violation in Allocations Profiler: Create a new per-thread backtrace buffer in ptls #44116
Conversation
Nice thanks. I’m a bit more comfortable with this, but need more input 🤷♂️ |
406d23c
to
d0677a0
Compare
Re-use the shared `ptls->bt_data` buffer from the thread-local storage for the buffer, to ensure that each thread has a separate buffer. This buffer is shared with the exception throwing mechanism, but is safe to share since julia exception throwing never interleaves with allocations profiling.
d0677a0
to
581374d
Compare
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
Build failing with a type error; fixed in #44235 which merges into this |
Is this ready to merge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM
Thanks Jameson :) I don't have permissions to merge this and @NHDaly is out on vacation, so if someone with permissions could merge that would be great. I think we'll also want to backport to 1.8 as well. Thanks! |
It already has the label so it will get backported. |
@KristofferC oh I see, great; you're way ahead of me :) |
Thanks Sacha 🙏 |
…-thread backtrace buffer in ptls (#44116) * Fix thread-safety violation in Allocations Profiler: Re-use the shared `ptls->bt_data` buffer from the thread-local storage for the buffer, to ensure that each thread has a separate buffer. This buffer is shared with the exception throwing mechanism, but is safe to share since julia exception throwing never interleaves with allocations profiling. * Approach two: Create a separate per-thread allocations backtrace buffer. * Update src/gc-alloc-profiler.cpp Co-authored-by: Jameson Nash <vtjnash@gmail.com> * Update src/gc-alloc-profiler.cpp Co-authored-by: Jameson Nash <vtjnash@gmail.com> * fix type error (#44235) * Update src/gc-alloc-profiler.cpp Co-authored-by: Jameson Nash <vtjnash@gmail.com> Co-authored-by: Pete Vilter <7341+vilterp@users.noreply.github.com> (cherry picked from commit 4e57966)
…-thread backtrace buffer in ptls (JuliaLang#44116) * Fix thread-safety violation in Allocations Profiler: Re-use the shared `ptls->bt_data` buffer from the thread-local storage for the buffer, to ensure that each thread has a separate buffer. This buffer is shared with the exception throwing mechanism, but is safe to share since julia exception throwing never interleaves with allocations profiling. * Approach two: Create a separate per-thread allocations backtrace buffer. * Update src/gc-alloc-profiler.cpp Co-authored-by: Jameson Nash <vtjnash@gmail.com> * Update src/gc-alloc-profiler.cpp Co-authored-by: Jameson Nash <vtjnash@gmail.com> * fix type error (JuliaLang#44235) * Update src/gc-alloc-profiler.cpp Co-authored-by: Jameson Nash <vtjnash@gmail.com> Co-authored-by: Pete Vilter <7341+vilterp@users.noreply.github.com>
…-thread backtrace buffer in ptls (JuliaLang#44116) * Fix thread-safety violation in Allocations Profiler: Re-use the shared `ptls->bt_data` buffer from the thread-local storage for the buffer, to ensure that each thread has a separate buffer. This buffer is shared with the exception throwing mechanism, but is safe to share since julia exception throwing never interleaves with allocations profiling. * Approach two: Create a separate per-thread allocations backtrace buffer. * Update src/gc-alloc-profiler.cpp Co-authored-by: Jameson Nash <vtjnash@gmail.com> * Update src/gc-alloc-profiler.cpp Co-authored-by: Jameson Nash <vtjnash@gmail.com> * fix type error (JuliaLang#44235) * Update src/gc-alloc-profiler.cpp Co-authored-by: Jameson Nash <vtjnash@gmail.com> Co-authored-by: Pete Vilter <7341+vilterp@users.noreply.github.com>
…-thread backtrace buffer in ptls (#44116) * Fix thread-safety violation in Allocations Profiler: Re-use the shared `ptls->bt_data` buffer from the thread-local storage for the buffer, to ensure that each thread has a separate buffer. This buffer is shared with the exception throwing mechanism, but is safe to share since julia exception throwing never interleaves with allocations profiling. * Approach two: Create a separate per-thread allocations backtrace buffer. * Update src/gc-alloc-profiler.cpp Co-authored-by: Jameson Nash <vtjnash@gmail.com> * Update src/gc-alloc-profiler.cpp Co-authored-by: Jameson Nash <vtjnash@gmail.com> * fix type error (#44235) * Update src/gc-alloc-profiler.cpp Co-authored-by: Jameson Nash <vtjnash@gmail.com> Co-authored-by: Pete Vilter <7341+vilterp@users.noreply.github.com>
…-thread backtrace buffer in ptls (#44116) * Fix thread-safety violation in Allocations Profiler: Re-use the shared `ptls->bt_data` buffer from the thread-local storage for the buffer, to ensure that each thread has a separate buffer. This buffer is shared with the exception throwing mechanism, but is safe to share since julia exception throwing never interleaves with allocations profiling. * Approach two: Create a separate per-thread allocations backtrace buffer. * Update src/gc-alloc-profiler.cpp Co-authored-by: Jameson Nash <vtjnash@gmail.com> * Update src/gc-alloc-profiler.cpp Co-authored-by: Jameson Nash <vtjnash@gmail.com> * fix type error (#44235) * Update src/gc-alloc-profiler.cpp Co-authored-by: Jameson Nash <vtjnash@gmail.com> Co-authored-by: Pete Vilter <7341+vilterp@users.noreply.github.com>
Another approach to fix #44099.
This is an alternative approach to #44114, but it creates a separate per-thread allocations backtrace buffer, to avoid potential sharing issues.
CC: @vilterp