-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Add warning on first startup if free disk space is less than necessary #25315
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
3ec10dd to
914e1e8
Compare
|
Confirmed this in an underpowered VM. I know it was discussed to use a warning instead of an error. I think that a warning, however, should probably not terminate the process. So perhaps it would be better to change this function to return |
Well thanks for testing - in this case we don't need to return at all, as the intention is to note the issue and carry on. Removed the return statement. |
735f677 to
f2d7bf5
Compare
When running on a VM with a small HDD, this prints the warning as expected. After downloading a number of blocks, then re-starting |
ce0c198 to
05ff20c
Compare
|
Disabled the warning on |
11c10ef to
6f935fd
Compare
|
Moved the check further down initialization, to the point where |
|
Concept ACK (as a warning only). |
|
I don't think the current location in initialization is correct. ~50 lines above, we start the thread for importing blocks from an external file. This thread will be copying the blocks from the external file to our datadir and then put them all into the block index. It additionally does not do We need to be checking the disk space before |
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
ConflictsNo conflicts as of last run. |
|
I agree with @achow101 I believe this should be done earlier. |
pablomartin4btc
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.
As @hernanmarino and @achow101, perhaps we could move that validation after the other 2 that also check disk space? (around line 1635)
11fc52c to
bba667e
Compare
|
As suggested, moved the check back to being alongside the other disk space checks. |
hernanmarino
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.
Code review ACK bba667e
|
Will need some accommodation for the tests - ignoring the message perhaps?:
|
pablomartin4btc
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.
Core review ACK.
And it works as expected, only displaying the warning the first time before we start loading blocks.
2022-08-08T19:01:43Z Opening LevelDB in /tmp/btc/chainstate
2022-08-08T19:01:43Z Opened LevelDB successfully
2022-08-08T19:01:43Z Wrote new obfuscate key for /tmp/btc/chainstate: f4392c646d173853
2022-08-08T19:01:43Z Using obfuscation key for /tmp/btc/chainstate: f4392c646d173853
2022-08-08T19:01:43Z init message: Verifying blocks…
2022-08-08T19:01:43Z block index 82ms
2022-08-08T19:01:43Z Warning: Disk space for "/tmp/btc/blocks" may not accommodate the block files. Approximately 460 GB of data will be stored in this directory.
2022-08-08T19:02:24Z loadblk thread start
2022-08-08T19:02:24Z UpdateTip: new best=000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f height=0 version=0x00000001 log2_work=32.000022 tx=1 date='2009-01-03T18:15:05Z' progress=0.000000 cache=0.0MiB(0txo)
2022-08-08T19:02:24Z block tree size = 1
2022-08-08T19:02:24Z nBestHeight = 0
2022-08-08T19:02:24Z Failed to open mempool file from disk. Continuing anyway.
2022-08-08T19:02:24Z loadblk thread exit
Also on the UI:
|
@Empact, I also get these 2 funtional tests failing when I run them locally (they pass on the master): |
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.
Concept and Code Review ACK bba667e.
I also verified that the warning is shown.
CI fails because the tests p2p_dos_header_tree.py and wallet_crosschain.py try to spawn a testnet chain, which would be too big for the CI and creates an output on stderr which should not happen.
This fix works on my machine but I haven't tested in CI:
diff --git a/test/functional/p2p_dos_header_tree.py b/test/functional/p2p_dos_header_tree.py
index fde1e4bfa..922e65036 100755
--- a/test/functional/p2p_dos_header_tree.py
+++ b/test/functional/p2p_dos_header_tree.py
@@ -22,6 +22,7 @@ class RejectLowDifficultyHeadersTest(BitcoinTestFramework):
self.setup_clean_chain = True
self.chain = 'testnet3' # Use testnet chain because it has an early checkpoint
self.num_nodes = 2
+ self.extra_args = [['-prune=550']] * self.num_nodes
def add_options(self, parser):
parser.add_argument(
@@ -62,7 +63,7 @@ class RejectLowDifficultyHeadersTest(BitcoinTestFramework):
self.log.info("Feed all fork headers (succeeds without checkpoint)")
# On node 0 it succeeds because checkpoints are disabled
- self.restart_node(0, extra_args=['-nocheckpoints'])
+ self.restart_node(0, extra_args=['-nocheckpoints', '-prune=550'])
peer_no_checkpoint = self.nodes[0].add_p2p_connection(P2PInterface())
peer_no_checkpoint.send_and_ping(msg_headers(self.headers_fork))
assert {
diff --git a/test/functional/wallet_crosschain.py b/test/functional/wallet_crosschain.py
index b6d0c8798..c0047542e 100755
--- a/test/functional/wallet_crosschain.py
+++ b/test/functional/wallet_crosschain.py
@@ -21,7 +21,7 @@ class WalletCrossChain(BitcoinTestFramework):
# Switch node 1 to testnet before starting it.
self.nodes[1].chain = 'testnet3'
- self.nodes[1].extra_args = ['-maxconnections=0'] # disable testnet sync
+ self.nodes[1].extra_args = ['-maxconnections=0', '-prune=550'] # disable testnet sync
with open(self.nodes[1].bitcoinconf, 'r', encoding='utf8') as conf:
conf_data = conf.read()
with open (self.nodes[1].bitcoinconf, 'w', encoding='utf8') as conf:
@@ -51,7 +51,7 @@ class WalletCrossChain(BitcoinTestFramework):
if not self.options.descriptors:
self.log.info("Override cross-chain wallet load protection")
self.stop_nodes()
- self.start_nodes([['-walletcrosschain']] * self.num_nodes)
+ self.start_nodes([['-walletcrosschain', '-prune=550']] * self.num_nodes)
self.nodes[0].loadwallet(node1_wallet)
self.nodes[1].loadwallet(node0_wallet)EDIT: it works in CI as well
2845677 to
1732375
Compare
To accommodate the expected blocks data. Co-authored-by: Antoine Poinsot <darosior@protonmail.com> Co-authored-by: benthecarman <benthecarman@live.com> Co-authored-by: Justin Litchfield <litch@me.com> Co-authored-by: Liran Cohen <c.liran.c@gmail.com> Co-authored-by: Ryan Loomba <ryan.loomba@gmail.com> Co-authored-by: Buck Perley <bucko.perley@gmail.com> Co-authored-by: bajjer <bajjer@bajjer.xyz> Co-authored-by: Suhail Saqan <suhail.saqan@gmail.com> Co-authored-by: Christopher Sweeney <sweeney.chris@gmail.com> Co-authored-by: Alyssa <orbitalturtle@protonmail.com> Co-authored-by: Ben Schroth <ben@styng.social> Co-authored-by: Jason Hester <mail@jason-hester.me> Co-authored-by: Matt Clough <Matt.clough@pm.me> Co-authored-by: Elise Schedler <eliseschedler@gmail.com> Co-authored-by: ghander <cen254@gmail.com> Co-authored-by: PopeLaz <btclz@fastmail.com> Co-authored-by: Aurèle Oulès <hello@aureleoules.com>
1732375 to
6630a1e
Compare
aureleoules
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.
ACK 6630a1e
|
ACK 6630a1e |
|
tACK 6630a1e rebased on master. Warning shows on first start but not on restart after some blocks have been downloaded. |
pablomartin4btc
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.
re-ACK 6630a1e
hernanmarino
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.
ReACK 6630a1e
|
Thanks to all the reviewers and contributors. For posterity, here's the original session in which this was written: https://youtu.be/tRXIkqM8gSI |


This reworks/revives #15848 to add a check for low disk space on first startup and issue a warning if disk space is below the expected space required to accommodate the blocks.
This PR was fashioned by a team of developers at the bitcoin++ conference workshop: "Let's contribute to Bitcoin Core"
Fixes #15813