lightningnetwork / lnd

Lightning Network Daemon ⚡️
MIT License
7.68k stars 2.08k forks source link

[bug]: LND doesn't shutdown immediately after send a interrupt signal #7349

Open eval-exec opened 1 year ago

eval-exec commented 1 year ago

Background

I build LND from on 35caaf3c53302245386768f231693ea3c4fd49b3, and start it, Ctrl-C it, but it doesn't shutdown immediately, wait 90 seconds, it finally shutdown.

Your environment

Steps to reproduce

  1. build lnd-debug by make
  2. start lnd-debug by ./lnd-debug --bitcoin.active --bitcoin.testnet --debuglevel=debug --bitcoin.node=neutrino --neutrino.connect=faucet.lightning.community --no-macaroons
  3. hit Ctrl-C

Expected behaviour

LND doesn't shutdown immediately.

Actual behaviour

LND shutdown after 90 seconds later.

eval-exec commented 1 year ago

The relative log is:

./lnd-debug --bitcoin.active --bitcoin.testnet --debuglevel=debug --bitcoin.node=neutrino --neutrino.connect=faucet.lightning.community --no-macaroons
2023-01-22 17:48:59.051 [WRN] LTND: open /home/exec/.lnd/lnd.conf: no such file or directory
2023-01-22 17:48:59.051 [INF] LTND: Version: 0.15.99-beta commit=tlv/v1.1.0-262-g35caaf3c5, build=development, logging=default, debuglevel=debug
2023-01-22 17:48:59.051 [INF] LTND: Active chain: Bitcoin (network=testnet)
2023-01-22 17:48:59.051 [INF] RPCS: Generating TLS certificates...
2023-01-22 17:48:59.052 [INF] RPCS: Done generating TLS certificates
2023-01-22 17:48:59.053 [DBG] RRPC: Router RPC server successfully register with root gRPC server
2023-01-22 17:48:59.053 [DBG] DRPC: DEV RPC server successfully register with root the gRPC server
2023-01-22 17:48:59.053 [DBG] VRPC: Versioner RPC server successfully registered with root gRPC server
2023-01-22 17:48:59.053 [INF] RPCS: RPC server listening on 127.0.0.1:10009
2023-01-22 17:48:59.054 [DBG] RRPC: Router REST server successfully registered with root REST server
2023-01-22 17:48:59.054 [DBG] DRPC: DEV REST server successfully registered with the root REST server
2023-01-22 17:48:59.054 [DBG] VRPC: Versioner REST server successfully registered with root REST server
2023-01-22 17:48:59.055 [INF] RPCS: gRPC proxy started at 127.0.0.1:8080
2023-01-22 17:48:59.055 [INF] LTND: Opening the main database, this might take a few minutes...
2023-01-22 17:48:59.055 [INF] LTND: Opening bbolt database, sync_freelist=false, auto_compact=false
2023-01-22 17:48:59.064 [INF] LTND: Creating local graph and channel state DB instances
2023-01-22 17:48:59.071 [DBG] CHDB: Populating in-memory channel graph, this might take a while...
2023-01-22 17:48:59.071 [DBG] CHDB: Finished populating in-memory channel graph (took 86.591µs, num_node_features=0, num_nodes=0, num_channels=0)
2023-01-22 17:48:59.071 [INF] CHDB: Checking for schema update: latest_version=29, db_version=29
2023-01-22 17:48:59.071 [INF] CHDB: Checking for optional update: prune_revocation_log=false, db_version=empty
2023-01-22 17:48:59.071 [INF] LTND: Database(s) now open (time_to_open=16.012623ms)!
2023-01-22 17:48:59.084 [INF] BTCN: Loaded 0 addresses from file '/home/exec/.lnd/data/chain/bitcoin/testnet/peers.json'
2023-01-22 17:48:59.084 [DBG] BTCN: Starting block notifications subscription manager
2023-01-22 17:48:59.084 [DBG] BTCN: Waiting for peer connection...
2023-01-22 17:48:59.084 [INF] BTCN: Registering block subscription: id=1
2023-01-22 17:48:59.084 [DBG] BTCN: Delivering backlog of block notifications: id=1, start_height=0, end_height=0
2023-01-22 17:48:59.084 [INF] LTND: We're not running within systemd or the service type is not 'notify'
2023-01-22 17:48:59.084 [INF] BTCN: Broadcaster now active
2023-01-22 17:48:59.084 [INF] LTND: Waiting for wallet encryption password. Use `lncli create` to create a wallet, `lncli unlock` to unlock an existing wallet, or `lncli changepassword` to change the password of an existing wallet and unlock it.
2023-01-22 17:48:59.116 [INF] BTCN: 2 addresses found from DNS seed x49.testnet-seed.bitcoin.jonasschnelli.ch
2023-01-22 17:48:59.269 [DBG] BTCN: Attempting to connect to 159.203.125.125:18333 (reqid 1)
2023-01-22 17:48:59.370 [INF] BTCN: 3 addresses found from DNS seed testnet-seed.bluematt.me
2023-01-22 17:48:59.819 [INF] BTCN: DNS discovery failed on seed testnet-seed.bitcoin.schildbach.de: lookup testnet-seed.bitcoin.schildbach.de: no such host
^C2023-01-22 17:49:01.667 [INF] LTND: Received interrupt
2023-01-22 17:49:01.667 [INF] LTND: Shutting down...
2023-01-22 17:49:01.667 [INF] LTND: Gracefully shutting down.
2023-01-22 17:49:01.668 [ERR] LTND: unable to set up wallet password listeners: shutting down
2023-01-22 17:49:01.668 [INF] BTCN: Canceling block subscription: id=1
2023-01-22 17:49:01.718 [DBG] BTCN: Stopping block notifications subscription manager
2023-01-22 17:49:01.719 [INF] BTCN: Block manager shutting down
2023-01-22 17:49:01.719 [INF] BTCN: Address manager shutting down
2023-01-22 17:49:14.341 [INF] BTCN: DNS discovery failed on seed x49.seed.tbtc.petertodd.org: lookup x49.seed.tbtc.petertodd.org: Temporary failure in name resolution
2023-01-22 17:50:59.271 [ERR] LTND: Shutting down because error in main method: error creating wallet config: unable to set up wallet password listeners: shutting down
2023-01-22 17:50:59.272 [INF] LTND: Shutdown complete
error creating wallet config: unable to set up wallet password listeners: shutting down
kaloudis commented 1 year ago

Looks to me that the DNS discovery for the that one neutrino node x49.seed.tbtc.petertodd.org is stalling everything. Will look into this.

Roasbeef commented 1 year ago

Looks to me that the DNS discovery for the that one neutrino node x49.seed.tbtc.petertodd.org is stalling everything.

Yeah that DNS seen looks to be bunk. Even if I drop the feature bit/version prefix (x49) I don't get any results. Over the years a lot of the testnet DNS seeds have atrophied.