-
Notifications
You must be signed in to change notification settings - Fork 69
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
IF: Fix threading issues in qc_chain & chain_pacemaker #1541
Comments
Comments in leap/libraries/hotstuff/qc_chain.cpp Lines 733 to 746 in 2315323
Comments in qc_chain.hpp leap/libraries/hotstuff/include/eosio/hotstuff/qc_chain.hpp Lines 149 to 161 in 2315323
Comments in qc_pacemaker.hpp leap/libraries/hotstuff/include/eosio/hotstuff/chain_pacemaker.hpp Lines 52 to 64 in 2315323
|
Note (1): the upcoming PR for this moves everything in qc_chain that isn't an interface to Note (2): the "Non-proposing leaders" / on_beat() comment is not a threading issue so I'm not addressing it in the upcoming PR (this item can be moved to another ticket if needed). Status: after validating the solution to the get_state cache (the overhead ended up just incrementing an uint64 inside the global engine mutex + qc_chain is now 100% lock-free internally + R/W lock at the cache that is at the chain_pacemaker now + cache update check itself is lock-free), I will work on "do not access chain state from net threads" next. |
- Moved everything in qc_chain.hpp that is not an interface to private: - Fixed test_hotstuff to use get_state() instead of accessing various (now) private fields - Fixed test_pacemaker to use get_id() instead of accessing (now) private _id field - Added get_proposal() helper method to finalizer_state struct in chain/hotstuff.hpp since finalizer_state is now used in tests, etc. - Made qc_chain class lock-free; all thread synchronization is now done externally - Solved concurrency get_finalizer_state vs. qc_chain updates by caching chain_pacemaker::get_state(); zero overhead on qc_chain state updating, low overhead on external state read (no global/write locks acquired on cache hits)
IF: Add thread safety to chain_pacemaker access of chain state
Depends on #1523.
Do not access chain state from net threads. Solution: signals from main thread to update internal HotStuff state. Then access to internal state from net threads is protected by mutex.
Also, get finalizer state request (protected by mutex) in http plugin should access finality state data from cache which is updated from threads that are modifying the finality state. Should be consistent to not see partial updates to state.
The text was updated successfully, but these errors were encountered: