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

@dcousens
Copy link
Contributor

dcousens commented Sep 17, 2015

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

@laanwj laanwj added the Bug label Sep 18, 2015
@morcos morcos force-pushed the morcos:lock_GetTransaction branch to 131c23d Sep 18, 2015
@morcos
Copy link
Member Author

morcos commented Sep 18, 2015

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

@dcousens
Copy link
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
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
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
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.