-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Reset pblocktree before deleting LevelDB file #12401
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
Conversation
|
@laanwj if I'm correct then this regression was introduced after v0.15.1 and so we might need a new rc. |
dc01184 to
7bd20cf
Compare
src/init.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the conditional is necessary. Also, perhaps add a comment that the reset is necessary to avoid temporarily having two CBlockTreeDB objects?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put the conditional there because under normal circumstances pblocktree.reset() is useless. However I don't know what it does under the hood; maybe the performance overhead is negligible.
|
|
|
Also paging @practicalswift. |
|
Thanks for the ping and thanks for finding+fixing this issue. utACK 7bd20cf466dfa5b2cccef00d1cd05bfbb8634f0d modulo the unnecessary conditional. |
7bd20cf to
8b986dc
Compare
|
Conditional removed. |
|
utACK 8b986dc5696db1d623465cb13d036bac722762e6 |
|
utACK 8b986dc5696db1d623465cb13d036bac722762e6 |
|
utACK |
promag
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 8b986dc.
src/init.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add comment here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added comment.
8b986dc to
a8b5d20
Compare
|
utACK a8b5d20 |
a8b5d20 Reset pblocktree before deleting LevelDB file (Sjors Provoost) Pull request description: #11043 repaced: ``` delete pblocktree; pblocktree = new CBlockTreeDB(nBlockTreeDBCache, false, fReset); ``` With: ``` pblocktree.reset(new CBlockTreeDB(nBlockTreeDBCache, false, fReset)); ``` This is problematic because `new CBlockTreeDB` tries to delete the existing file, which will fail with `LOCK: already held by process` if it's still open. That's the case for QT. When QT finds a problem with the index it will ask the user if they want to reindex. At that point it has already opened `blocks/index`. It then runs this [while loop](https://github.com/bitcoin/bitcoin/blob/v0.16.0rc3/src/init.cpp#L1415) again with `fReset = 1`, resulting in the above error. This change makes that error go away, presumably because `reset()` without an argument closes the file. Tree-SHA512: fde8b546912f6773ac64da8476673cc270b125aa2d909212391d1a2001b35c8260a8772126b99dfd76b39faaa286feb7c43239185fe584bd4dc2bc04a64044ce
Github-Pull: bitcoin#12401 Rebased-From: a8b5d20 Tree-SHA512: 3a87b6113283c3588f46bb5c725ec33ac639e2f91c589b5c0eb4375e3d23bd6c18e7ba96faf70be2afea86d8e6252bf4dbcf9c9ed166ce2d49846ff947a36d2e
a8b5d20 Reset pblocktree before deleting LevelDB file (Sjors Provoost) Pull request description: bitcoin#11043 repaced: ``` delete pblocktree; pblocktree = new CBlockTreeDB(nBlockTreeDBCache, false, fReset); ``` With: ``` pblocktree.reset(new CBlockTreeDB(nBlockTreeDBCache, false, fReset)); ``` This is problematic because `new CBlockTreeDB` tries to delete the existing file, which will fail with `LOCK: already held by process` if it's still open. That's the case for QT. When QT finds a problem with the index it will ask the user if they want to reindex. At that point it has already opened `blocks/index`. It then runs this [while loop](https://github.com/bitcoin/bitcoin/blob/v0.16.0rc3/src/init.cpp#L1415) again with `fReset = 1`, resulting in the above error. This change makes that error go away, presumably because `reset()` without an argument closes the file. Tree-SHA512: fde8b546912f6773ac64da8476673cc270b125aa2d909212391d1a2001b35c8260a8772126b99dfd76b39faaa286feb7c43239185fe584bd4dc2bc04a64044ce
Summary: a8b5d20 Reset pblocktree before deleting LevelDB file (Sjors Provoost) Pull request description: #11043 repaced: ``` delete pblocktree; pblocktree = new CBlockTreeDB(nBlockTreeDBCache, false, fReset); ``` With: ``` pblocktree.reset(new CBlockTreeDB(nBlockTreeDBCache, false, fReset)); ``` This is problematic because `new CBlockTreeDB` tries to delete the existing file, which will fail with `LOCK: already held by process` if it's still open. That's the case for QT. When QT finds a problem with the index it will ask the user if they want to reindex. At that point it has already opened `blocks/index`. It then runs this [while loop](https://github.com/bitcoin/bitcoin/blob/v0.16.0rc3/src/init.cpp#L1415) again with `fReset = 1`, resulting in the above error. This change makes that error go away, presumably because `reset()` without an argument closes the file. Tree-SHA512: fde8b546912f6773ac64da8476673cc270b125aa2d909212391d1a2001b35c8260a8772126b99dfd76b39faaa286feb7c43239185fe584bd4dc2bc04a64044ce Backport of Core [[bitcoin/bitcoin#12401 | PR12401]] Test Plan: ninja ninja check-all src/bitoin-qt Reviewers: O1 Bitcoin ABC, #bitcoin_abc, jasonbcox Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, jasonbcox Differential Revision: https://reviews.bitcoinabc.org/D6632
Summary: a8b5d20 Reset pblocktree before deleting LevelDB file (Sjors Provoost) Pull request description: #11043 repaced: ``` delete pblocktree; pblocktree = new CBlockTreeDB(nBlockTreeDBCache, false, fReset); ``` With: ``` pblocktree.reset(new CBlockTreeDB(nBlockTreeDBCache, false, fReset)); ``` This is problematic because `new CBlockTreeDB` tries to delete the existing file, which will fail with `LOCK: already held by process` if it's still open. That's the case for QT. When QT finds a problem with the index it will ask the user if they want to reindex. At that point it has already opened `blocks/index`. It then runs this [while loop](https://github.com/bitcoin/bitcoin/blob/v0.16.0rc3/src/init.cpp#L1415) again with `fReset = 1`, resulting in the above error. This change makes that error go away, presumably because `reset()` without an argument closes the file. Tree-SHA512: fde8b546912f6773ac64da8476673cc270b125aa2d909212391d1a2001b35c8260a8772126b99dfd76b39faaa286feb7c43239185fe584bd4dc2bc04a64044ce Backport of Core [[bitcoin/bitcoin#12401 | PR12401]] Test Plan: ninja ninja check-all src/bitoin-qt Reviewers: O1 Bitcoin ABC, #bitcoin_abc, jasonbcox Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, jasonbcox Differential Revision: https://reviews.bitcoinabc.org/D6632
#11043 repaced:
With:
This is problematic because
new CBlockTreeDBtries to delete the existing file, which will fail withLOCK: already held by processif it's still open. That's the case for QT.When QT finds a problem with the index it will ask the user if they want to reindex. At that point it has already opened
blocks/index. It then runs this while loop again withfReset = 1, resulting in the above error.This change makes that error go away, presumably because
reset()without an argument closes the file.