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

runtime: fix double-readlock in in_mem_accounts_index.rs #26047

Merged
merged 1 commit into from
Jun 20, 2022

Conversation

BurtonQin
Copy link
Contributor

Problem

There is a possible deadlock caused by double readlock in assert! in fn write_startup_info_to_disk.
The read lock on L1024 is not released before acquiring another read lock on L1025.
For more details on this kind of deadlock, see
https://www.reddit.com/r/rust/comments/urnqz8/different_behaviors_of_recursive_read_locks_in/
Interestingly, the readlock on L1022 is immediately released and does not cause deadlock.

Summary of Changes

The fix is to acquire the read lock once and reuse it.

Fixes #

@mergify mergify bot added the community Community contribution label Jun 18, 2022
@mergify mergify bot requested a review from a team June 18, 2022 04:01
@jstarry jstarry merged commit 95ea506 into solana-labs:master Jun 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Community contribution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants