add block_hash to head_info so we can easily use them later #3060
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.
I suspect the
header_mmr.read()
lock in get_server_stats is causing issues as every peer thread needs write access to the header_mmr for processing blocks and block headers.I have seen anecdotal evidence that something is causing a deadlock and gdb indicates the stuck tui is blocked waiting on a read() lock. Just not 100% sure which read lock, but this is a likely candidate).
There is no need to lock the header_mmr here just to read several headers by height to find their block hashes. It makes more sense to simply track these block hashes when we build the difficulty iterator initially.
We also update the tui stats every 1s or so, which introduces the potential for lock contention on this header_mmr via the tui thread.
Currently running a node on mainnet with these changes applied and TUI enabled. I'd like to let this run for a bit to see if we can still reproduce the deadlock scenario or if these changes do appear to alleviate the issue.