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

Deadlock with backtrace-rs based stack unwinding #38

Open
sargarass opened this issue Sep 16, 2024 · 0 comments
Open

Deadlock with backtrace-rs based stack unwinding #38

sargarass opened this issue Sep 16, 2024 · 0 comments

Comments

@sargarass
Copy link

I believe a deadlock can occur when one thread is making allocations while another thread is directly performing trace unwinding using backtrace-rs and also needs to allocate.

So, thread 1 acquires a lock with the following path:
step 1
step 2
step 3

And thread 2 acquires the lock in the opposite order.
step 1
step 2

It's interesting to note that using the backtrace-rs API with its inner lock is a bit weird because std also uses backtrace-rs for thread unwinding (link 1, link 2), but it employs a different lock for this purpose. Consequently, the lock inside backtrace-rs doesn't ensure exclusive access to its internals.

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

No branches or pull requests

1 participant