Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
community Community contribution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants