Skip to content
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

Fix locking in GetTransaction. #6688

Merged
merged 1 commit into from Sep 23, 2015
Merged

Conversation

morcos
Copy link
Member

@morcos morcos commented Sep 17, 2015

GetTransaction needs to lock cs_main until ReadBlockFromDisk completes because the data inside CBlockIndex's can change since pruning. This lock was held by all calls to GetTransaction except rest_tx.

@sipa
Copy link
Member

sipa commented Sep 17, 2015 via email

@dcousens
Copy link
Contributor

@morcos in this case, you can just remove that scoping block.

utACK

GetTransaction needs to lock cs_main until ReadBlockFromDisk completes, the data inside CBlockIndex's can change since pruning.  This lock was held by all calls to GetTransaction except rest_tx.
@laanwj
Copy link
Member

laanwj commented Sep 18, 2015

This is unfortunate. Can we do reading the block from disk without lock, at least? E.g. the i/o itself. cs_main is extremely contended, it's not nice to hold it during longer operations.

Though utACK anyway...

@morcos
Copy link
Member Author

morcos commented Sep 18, 2015

@dcousens oops, thanks.. also removed another unnecessary scoping block.

@dcousens
Copy link
Contributor

utACK, agreed with @laanwj, but that is something we should address in another PR IMHO.

@laanwj laanwj merged commit 131c23d into bitcoin:master Sep 23, 2015
laanwj added a commit that referenced this pull request Sep 23, 2015
131c23d Fix locking in GetTransaction. (Alex Morcos)
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants