fix(store/state): perform potentially blocking RocksDB access in a blocking context#2076
Open
kkovaacs wants to merge 3 commits into
Open
fix(store/state): perform potentially blocking RocksDB access in a blocking context#2076kkovaacs wants to merge 3 commits into
kkovaacs wants to merge 3 commits into
Conversation
…king task The account and nullifier trees may be backed by `RocksDB`, so tree access must not run on an async worker thread directly.
The account state forest may be backed by `RocksDB`, so access must not run on an async worker thread directly.
Collaborator
Mirko-von-Leipzig
left a comment
There was a problem hiding this comment.
Looks fine ito code, I'm just a bit concerned that we're using block_in_place? Should these be spawn_blocking?
Comment on lines
+147
to
+148
| tokio::runtime::Handle::current() | ||
| .block_on(db_update_task)? |
Collaborator
There was a problem hiding this comment.
Should we be using block_on? I guess we're sort of saved because we know this will only happen once, and always sequentially?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR moves runtime access to RocksDB-backed store state structures onto Tokio’s blocking path via
block_in_place().State::innerandState::forestlock access.storage_map_key_cacheupdates on the normal async path since they do not touch the RocksDB-backed forest. Likewise,blockchainoperations are entirely in-memory, so those too are left in async context.Using
block_in_place()is required because usingspawn_blocking()would require the closure to be'static, which in turn would require having an additionalArcwrapper aroundinnerandforest.Closes #1969