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

[feat]: Automatically detect and delete corrupt peers.dat #98

Open
1 task done
gStart9 opened this issue Oct 14, 2022 · 2 comments
Open
1 task done

[feat]: Automatically detect and delete corrupt peers.dat #98

gStart9 opened this issue Oct 14, 2022 · 2 comments
Assignees
Labels
Enhancement New feature or request Known Solution General solution is known, just requires implementation Needs Scoping Requirements are not fully defined Needs Triage Not enough information to determine priority

Comments

@gStart9
Copy link
Member

gStart9 commented Oct 14, 2022

Prerequisites

  • I have searched for existing issues that already suggest this feature.

Describe the Feature Request

Some of our users (including me) are still experiencing this. This feature will allow bitcoind to get out of its endless restart loop. If peers.dat is corrupt when bitcoin starts, it shuts down (presumably usually caused by a power outage/unplugging of the pi while peers.dat is being written). Since embassyd trys to restart stopped containers, bitcoind just goes into and endless restart loop:

Log excerpt from restart loop:

2022-10-14T18:21:38+00:00 2022-10-14T18:21:38Z Bitcoin Core version v23.0.0 (release build)
2022-10-14T18:21:38+00:00 2022-10-14T18:21:38Z InitParameterInteraction: parameter interaction: -proxy set -> setting -upnp=0
2022-10-14T18:21:38+00:00 2022-10-14T18:21:38Z InitParameterInteraction: parameter interaction: -proxy set -> setting -natpmp=0
2022-10-14T18:21:38+00:00 2022-10-14T18:21:38Z InitParameterInteraction: parameter interaction: -proxy set -> setting -discover=0
2022-10-14T18:21:38+00:00 2022-10-14T18:21:38Z Assuming ancestors of block 000000000000000000052d314a259755ca65944e68df6b12a067ea8f1f5a7091 have valid signatures.
2022-10-14T18:21:38+00:00 2022-10-14T18:21:38Z Setting nMinimumChainWork=00000000000000000000000000000000000000002927cdceccbd5209e81e80db
2022-10-14T18:21:38+00:00 2022-10-14T18:21:38Z Using the 'standard' SHA256 implementation
2022-10-14T18:21:38+00:00 2022-10-14T18:21:38Z Default data directory /root/.bitcoin
2022-10-14T18:21:38+00:00 2022-10-14T18:21:38Z Using data directory /root/.bitcoin
2022-10-14T18:21:38+00:00 2022-10-14T18:21:38Z Config file: /root/.bitcoin/bitcoin.conf
...
2022-10-14T18:21:38+00:00 2022-10-14T18:21:38Z Command-line arg: conf="/root/.bitcoin/bitcoin.conf"
2022-10-14T18:21:38+00:00 2022-10-14T18:21:38Z Command-line arg: datadir="/root/.bitcoin"
2022-10-14T18:21:38+00:00 2022-10-14T18:21:38Z Command-line arg: externalip="myreallylong.onion"
2022-10-14T18:21:38+00:00 2022-10-14T18:21:38Z Command-line arg: onion="172.18.0.1:9050"
2022-10-14T18:21:38+00:00 2022-10-14T18:21:38Z Command-line arg: proxy="172.18.0.1:9050"
2022-10-14T18:21:38+00:00 2022-10-14T18:21:38Z Using at most 125 automatic connections (1048576 file descriptors available)
2022-10-14T18:21:38+00:00 2022-10-14T18:21:38Z Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2022-10-14T18:21:38+00:00 2022-10-14T18:21:38Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2022-10-14T18:21:38+00:00 2022-10-14T18:21:38Z Script verification uses 3 additional threads
2022-10-14T18:21:38+00:00 2022-10-14T18:21:38Z scheduler thread start
2022-10-14T18:21:38+00:00 2022-10-14T18:21:38Z WARNING: the RPC server is not safe to expose to untrusted networks such as the public internet
2022-10-14T18:21:38+00:00 2022-10-14T18:21:38Z HTTP: creating work queue of depth 64
2022-10-14T18:21:38+00:00 2022-10-14T18:21:38Z Config options rpcuser and rpcpassword will soon be deprecated. Locally-run instances may remove rpcuser to use cookie-based auth, or may be replaced with rpcauth. Please see share/rpcauth for rpcauth auth generation.
2022-10-14T18:21:38+00:00 2022-10-14T18:21:38Z HTTP: starting 16 worker threads
2022-10-14T18:21:38+00:00 2022-10-14T18:21:38Z Using wallet directory /root/.bitcoin
2022-10-14T18:21:38+00:00 2022-10-14T18:21:38Z init message: Verifying wallet(s)…
2022-10-14T18:21:38+00:00 2022-10-14T18:21:38Z Using /16 prefix for IP bucketing
2022-10-14T18:21:38+00:00 2022-10-14T18:21:38Z init message: Loading P2P addresses…
2022-10-14T18:21:40+00:00 2022-10-14T18:21:40Z Error: Invalid or corrupt peers.dat (Checksum mismatch, data corrupted). If you believe this is a bug, please report it to https://github.com/bitcoin/bitcoin/issues. As a workaround, you can move the file ("/root/.bitcoin/peers.dat") out of the way (rename, move, or delete) to have a new one created on the next start.
2022-10-14T18:21:40+00:00 Error: Invalid or corrupt peers.dat (Checksum mismatch, data corrupted). If you believe this is a bug, please report it to https://github.com/bitcoin/bitcoin/issues. As a workaround, you can move the file ("/root/.bitcoin/peers.dat") out of the way (rename, move, or delete) to have a new one created on the next start.
2022-10-14T18:21:40+00:00 2022-10-14T18:21:40Z Shutdown: In progress...
2022-10-14T18:21:41+00:00 2022-10-14T18:21:41Z scheduler thread exit
2022-10-14T18:21:41+00:00 2022-10-14T18:21:41Z Shutdown: done

Describe the Use Case

Bitcoin and all other services dependent on bitcoin are dead in the water until peers.dat is deleted and bitcoin can start syncing again.

Describe Preferred Solution

Detect the corrupt peers.dat in the log file, and automatically delete it if it's corrupt. This will require less human intervention and attention, so it's much better than the alternative solution.

Describe Alternatives

"Delete peers.dat" option under Services > Bitcoin Core > Actions

@gStart9 gStart9 added Enhancement New feature or request Needs Scoping Requirements are not fully defined Known Solution General solution is known, just requires implementation Needs Triage Not enough information to determine priority labels Oct 14, 2022
@gStart9
Copy link
Member Author

gStart9 commented Oct 14, 2022

Tagged support people in case you guys have input. Added Matt for sanity checking / alternative viability / scoping / prior knowledge / further assignment purposes.

@kn0wmad
Copy link
Contributor

kn0wmad commented Oct 16, 2022

Tagged support people in case you guys have input. Added Matt for sanity checking / alternative viability / scoping / prior knowledge / further assignment purposes.

At this time, protocol is to assign the service owner, in this case @dr-bonez I believe, and then you can pass the link on for comment. We want to avoid having multiple assignees. I think this is slated for the v24 update / refresh.

@gStart9 gStart9 changed the title [feat]: add "Delete peers.dat" action [feat]: Automatically detect and delete corrupt peers.dat Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request Known Solution General solution is known, just requires implementation Needs Scoping Requirements are not fully defined Needs Triage Not enough information to determine priority
Projects
None yet
Development

No branches or pull requests

5 participants