-
Notifications
You must be signed in to change notification settings - Fork 232
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
AccountsDb: make write_accounts_to_cache() never block sending to the bg hasher #3814
Conversation
… bg hasher Avoid commit_transactions() => store() => store_accounts_to() callers having to notify the bg hasher thread by doing an explicit sleep instead of sleeping on channel.recv() when the channel is empty. This avoids the case in which multiple replay/banking threads call commit_transactions() at the same time and end up... sleeping themselves acquiring the mutex to wake up the bg hasher.
Can you help me understand, please? On the agave/accounts-db/src/accounts_db.rs Lines 6531 to 6534 in c11fe18
Are you saying that agave/accounts-db/src/accounts_db.rs Line 2347 in c11fe18
|
Or is the issue because notify receivers in send(): grab a lock to wake up a receiver: |
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.
(assuming my understanding in #3814 (comment) is correct)
@@ -2355,7 +2355,10 @@ impl AccountsDb { | |||
}; | |||
} | |||
} | |||
Err(err) => { | |||
Err(TryRecvError::Empty) => { | |||
sleep(Duration::from_millis(5)); |
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.
I'm not sure what the "right" sleep duration should be here, but 5 ms seems fine to start with.
correct, the issue is racing to notify, sleeping on the lock |
Backports to the beta branch are to be avoided unless absolutely necessary for fixing bugs, security issues, and perf regressions. Changes intended for backport should be structured such that a minimum effective diff can be committed separately from any refactoring, plumbing, cleanup, etc that are not strictly necessary to achieve the goal. Any of the latter should go only into master and ride the normal stabilization schedule. Exceptions include CI/metrics changes, CLI improvements and documentation updates on a case by case basis. |
… bg hasher (#3814) Avoid commit_transactions() => store() => store_accounts_to() callers having to notify the bg hasher thread by doing an explicit sleep instead of sleeping on channel.recv() when the channel is empty. This avoids the case in which multiple replay/banking threads call commit_transactions() at the same time and end up... sleeping themselves acquiring the mutex to wake up the bg hasher. (cherry picked from commit f2e3e39)
Avoid commit_transactions() => store() => store_accounts_to() callers having to notify the bg hasher thread by doing an explicit sleep instead of sleeping on channel.recv() when the channel is empty. This avoids the case in which multiple replay/banking threads call commit_transactions() at the same time and end up... sleeping themselves acquiring the mutex to wake up the bg hasher.
Right side of the marker is with this PR