Skip to content

Conversation

@morcos
Copy link
Contributor

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

@laanwj laanwj added the Bug label Sep 18, 2015
@morcos morcos force-pushed the lock_GetTransaction branch from b6b8552 to 131c23d Compare September 18, 2015 03:09
@morcos
Copy link
Contributor 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.

4 participants