question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NBXplorer periodically disconnecting from bitcoind

See original GitHub issue

After an update to the latest version NBXplorer keeps disconnecting and reconnecting to Bitcoind.

Steps to reproduce:

  1. Setup regtest instance with NBXplorer
  2. Mine 101 blocks
  3. Wait and see logs
  4. Optionally check /v1/cryptos/btc/status in a loop with 1-second sleep

Expected behavior

NBXplorer connects once and stays connected. After initial sync it keeps reporting fully synced

Actual behavior

NBXplorer disconnects and resyncs ~every second

Log
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Configuration:  BTC: Height: 101
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Explorer:       BTC: Handshaked node
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Explorer:       BTC: Current Index Progress not found, start syncing from the header's chain tip (At height: 101)
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Explorer:       BTC: Starting scan at block 101
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Events:         BTC: Node state changed: NotStarted => NBXplorerSynching
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Events:         BTC: Node state changed: NBXplorerSynching => Ready
Nov 11 13:49:20 disp9630 nbxplorer[7276]: fail: Explorer:       BTC: Connection unexpectedly failed: Unexpected exception while connecting to socket
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Events:         BTC: Node state changed: Ready => NotStarted
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Configuration:  BTC: Testing RPC connection to http://127.0.0.1:18443/
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Configuration:  BTC: RPC connection successful
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Configuration:  BTC: Full node version detected: 210100
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Configuration:  BTC: Loading chain from cache...
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Configuration:  BTC: Height: 101
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Configuration:  BTC: Trying to connect via the P2P protocol to trusted node (127.0.0.1:18444)...
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Explorer:       BTC: TCP Connection succeed, handshaking...
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Explorer:       BTC: Handshaked
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Configuration:  BTC: Loading chain from node
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Explorer:       BTC: Loading chain...
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Explorer:       BTC: Chain loaded
Nov 11 13:49:20 disp9630 nbxplorer[7276]: warn: Explorer:       BTC: Your NBXplorer server is not whitelisted by your node, you should add "whitelist=127.0.0.1" to the configuration file of your node. (Or use whitebind)
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Configuration:  BTC: Height: 101
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Explorer:       BTC: Handshaked node
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Explorer:       BTC: Current Index Progress not found, start syncing from the header's chain tip (At height: 101)
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Explorer:       BTC: Starting scan at block 101
Nov 11 13:49:20 disp9630 nbxplorer[7276]: fail: Explorer:       BTC: Connection unexpectedly failed: Unexpected exception while connecting to socket
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Events:         BTC: Node state changed: NotStarted => NBXplorerSynching
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Events:         BTC: Node state changed: NBXplorerSynching => NotStarted
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Configuration:  BTC: Testing RPC connection to http://127.0.0.1:18443/
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Configuration:  BTC: RPC connection successful
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Configuration:  BTC: Full node version detected: 210100
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Configuration:  BTC: Loading chain from cache...
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Configuration:  BTC: Height: 101
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Configuration:  BTC: Trying to connect via the P2P protocol to trusted node (127.0.0.1:18444)...
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Explorer:       BTC: TCP Connection succeed, handshaking...
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Explorer:       BTC: Handshaked
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Configuration:  BTC: Loading chain from node
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Explorer:       BTC: Loading chain...
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Explorer:       BTC: Chain loaded
Nov 11 13:49:20 disp9630 nbxplorer[7276]: warn: Explorer:       BTC: Your NBXplorer server is not whitelisted by your node, you should add "whitelist=127.0.0.1" to the configuration file of your node. (Or use whitebind)
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Configuration:  BTC: Height: 101
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Explorer:       BTC: Handshaked node
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Explorer:       BTC: Current Index Progress not found, start syncing from the header's chain tip (At height: 101)
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Explorer:       BTC: Starting scan at block 101
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Events:         BTC: Node state changed: NotStarted => NBXplorerSynching
Nov 11 13:49:20 disp9630 nbxplorer[7276]: info: Events:         BTC: Node state changed: NBXplorerSynching => Ready
Nov 11 13:49:21 disp9630 nbxplorer[7276]: fail: Explorer:       BTC: Connection unexpectedly failed: Unexpected exception while connecting to socket
Nov 11 13:49:21 disp9630 nbxplorer[7276]: info: Events:         BTC: Node state changed: Ready => NotStarted
Nov 11 13:49:21 disp9630 nbxplorer[7276]: info: Configuration:  BTC: Testing RPC connection to http://127.0.0.1:18443/
Nov 11 13:49:21 disp9630 nbxplorer[7276]: info: Configuration:  BTC: RPC connection successful
Nov 11 13:49:21 disp9630 nbxplorer[7276]: info: Configuration:  BTC: Full node version detected: 210100
Nov 11 13:49:21 disp9630 nbxplorer[7276]: info: Configuration:  BTC: Loading chain from cache...
Nov 11 13:49:21 disp9630 nbxplorer[7276]: info: Configuration:  BTC: Height: 101
Nov 11 13:49:21 disp9630 nbxplorer[7276]: info: Configuration:  BTC: Trying to connect via the P2P protocol to trusted node (127.0.0.1:18444)...
Nov 11 13:49:21 disp9630 nbxplorer[7276]: info: Explorer:       BTC: TCP Connection succeed, handshaking...
Nov 11 13:49:21 disp9630 nbxplorer[7276]: info: Explorer:       BTC: Handshaked
Nov 11 13:49:21 disp9630 nbxplorer[7276]: info: Configuration:  BTC: Loading chain from node
Nov 11 13:49:21 disp9630 nbxplorer[7276]: info: Explorer:       BTC: Loading chain...
Nov 11 13:49:21 disp9630 nbxplorer[7276]: info: Explorer:       BTC: Chain loaded
Nov 11 13:49:21 disp9630 nbxplorer[7276]: warn: Explorer:       BTC: Your NBXplorer server is not whitelisted by your node, you should add "whitelist=127.0.0.1" to the configuration file of your node. (Or use whitebind)
Nov 11 13:49:21 disp9630 nbxplorer[7276]: info: Configuration:  BTC: Height: 101
Nov 11 13:49:21 disp9630 nbxplorer[7276]: info: Explorer:       BTC: Handshaked node
Nov 11 13:49:21 disp9630 nbxplorer[7276]: info: Explorer:       BTC: Current Index Progress not found, start syncing from the header's chain tip (At height: 101)
Nov 11 13:49:21 disp9630 nbxplorer[7276]: info: Explorer:       BTC: Starting scan at block 101
Nov 11 13:49:21 disp9630 nbxplorer[7276]: info: Events:         BTC: Node state changed: NotStarted => NBXplorerSynching
Nov 11 13:49:21 disp9630 nbxplorer[7276]: info: Events:         BTC: Node state changed: NBXplorerSynching => Ready

Last known working version: 2.1.58 I managed to bisect it. It works in 2.2.4 and breaks in 2.2.5

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
NicolasDoriercommented, Apr 25, 2022

@farukterzioglu whitelisting is not only required for mempool, but to prevent your NBXplorer stop suddenly working. If your node isn’t whitelisted bitcoin core is free to kick you out anytime. (and it does) I could not issue mempool command if not whitelisted, but this is just a time bomb.

1reaction
farukterzioglucommented, Mar 6, 2022

@NicolasDorier It looks like whitelisting is no longer optional. As you can see from this diff: https://github.com/dgarage/NBXplorer/compare/v2.2.4...v2.2.5 mempool request has been added and bitcoin node requires whitelisting for mempool requests as mentioned in #344

When I try to connect to a node (regtest) without whitelist it never connects and tries in an endless loop. At the same time when I check the bitcoin node I can see it disconnects (repeatedly) NBXplorer because of misbehavior: mempool request with bloom filters

image

and NBxplorer is being stuck like this; image

Read more comments on GitHub >

github_iconTop Results From Across the Web

new Apollo miner keeps disconnecting from WIFI
Seems to be working good, except once every 24-26 hours or so, it disconnects from my WIFI, and I have to manually reconnect...
Read more >
bitcoind syncing headers but not blocks
Going to answer my own question. Looks like it is the prune= option that disables the NETWORK service and stops the node from...
Read more >
BIP 0338 - Bitcoin Wiki
This BIP describes a change to the p2p protocol to allow a node to tell a peer that a connection will not be...
Read more >
Running Bitcoind
Running Bitcoind shows users two variations of the original bitcoin program available; one with a graphical user interface (usually referred to as just ......
Read more >
Bitcoin Core 22.0
If you are running an older version, shut it down. Wait until it has completely shut down (which might take a few minutes...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found