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

Conversation

Projects
None yet
4 participants
@morcos
Member

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

This comment has been minimized.

Show comment
Hide comment
@sipa

sipa Sep 17, 2015

Member
Member

sipa commented Sep 17, 2015

@dcousens

This comment has been minimized.

Show comment
Hide comment
@dcousens

dcousens Sep 17, 2015

Contributor

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

utACK

Contributor

dcousens commented Sep 17, 2015

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

utACK

Fix locking in GetTransaction.
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

This comment has been minimized.

Show comment
Hide comment
@laanwj

laanwj Sep 18, 2015

Member

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...

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...

@laanwj laanwj added the Bug label Sep 18, 2015

@morcos

This comment has been minimized.

Show comment
Hide comment
@morcos

morcos Sep 18, 2015

Member

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

Member

morcos commented Sep 18, 2015

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

@dcousens

This comment has been minimized.

Show comment
Hide comment
@dcousens

dcousens Sep 19, 2015

Contributor

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

Contributor

dcousens commented Sep 19, 2015

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

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

laanwj added a commit that referenced this pull request Sep 23, 2015

Merge pull request #6688
131c23d Fix locking in GetTransaction. (Alex Morcos)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment