Lnd: autopilot/fundingmanager nil pointer dereference

Created on 28 Sep 2019  路  4Comments  路  Source: lightningnetwork/lnd

Background

After upgrading to v0.8.0-beta-rc1 my node will crash when using autopilot. Running without autopilot does not crash.

Your environment

  • version of lnd
    0.8.0-beta commit=v0.8.0-beta-rc1
  • which operating system (uname -a on *Nix)
    Debian 10
  • version of btcd, bitcoind, or other backend
    v0.18.1.0-00ffe5aca
  • any other relevant environment details

Steps to reproduce

Run lnd with autopilot enabled.

Expected behaviour

Doesn't crash.

Actual behaviour

Does crash.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xe19fc8]

goroutine 347 [running]:
github.com/lightningnetwork/lnd/lnwire.(*FeatureVector).HasFeature(...)
/home/user/gocode/src/github.com/lightningnetwork/lnd/lnwire/features.go:283
github.com/lightningnetwork/lnd.(*fundingManager).handleInitFundingMsg(0xc0004b5b00, 0xc002d56ee0)
/home/user/gocode/src/github.com/lightningnetwork/lnd/fundingmanager.go:2773 +0x418
github.com/lightningnetwork/lnd.(*fundingManager).reservationCoordinator(0xc0004b5b00)
/home/user/gocode/src/github.com/lightningnetwork/lnd/fundingmanager.go:753 +0x5ec
created by github.com/lightningnetwork/lnd.(*fundingManager).start
/home/user/gocode/src/github.com/lightningnetwork/lnd/fundingmanager.go:548 +0x562
P2 bug crash v0.8.0

Most helpful comment

Looks like we are not checking whether the peer has completed the handshake before attempting to open a channel.

All 4 comments

I started a new lnd testnet node without autopilot and I'm running into the same problem.

lnd version 0.8.0-beta commit=v0.8.0-beta-rc1-dirty
MacOS 10.14.6
bitcoind v0.18.1

Open channel log is here: funding_log.txt

The tail of the log:

lncli openchannel --node_key 03d5e17a3c213fe490e1b0c389f8cfcfcea08a29717d50a9f453735e0ab2a7c003 --connect 3.16.119.191:9735 --local_amt 1000000 --push_amt 500000
{
    "funding_txid": "cc097731a8db60a50e15516a579e9241d74db9838aa3ff2a933cfc37917818de"
}

2019-09-29 02:09:56.870 [INF] FNDG: Initiating fundingRequest(local_amt=0.01 BTC (subtract_fees=false), push_amt=500000000 mSAT, chain_hash=000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943, peer=031c64a68e6d1b9e50711336d92b434c584ce668b2fae59ee688bd73713fee1569, dust_limit=0.00000573 BTC, min_confs=1)
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1a82515]

goroutine 396 [running]:
github.com/lightningnetwork/lnd/lnwire.(*FeatureVector).HasFeature(...)
    /Users/vwoo/gocode/src/github.com/lightningnetwork/lnd/lnwire/features.go:283
github.com/lightningnetwork/lnd.(*fundingManager).handleInitFundingMsg(0xc00018d9e0, 0xc000f33ca0)
    /Users/vwoo/gocode/src/github.com/lightningnetwork/lnd/fundingmanager.go:2773 +0x435
github.com/lightningnetwork/lnd.(*fundingManager).reservationCoordinator(0xc00018d9e0)
    /Users/vwoo/gocode/src/github.com/lightningnetwork/lnd/fundingmanager.go:753 +0x639
created by github.com/lightningnetwork/lnd.(*fundingManager).start
    /Users/vwoo/gocode/src/github.com/lightningnetwork/lnd/fundingmanager.go:548 +0x5b3

Can also confirm that both manually open channel and using autopilot causes a crash.

Manual:

2019-09-29 14:48:43.470 7424-0/? E/Go: panic: runtime error: invalid memory address or nil pointer dereference
2019-09-29 14:48:43.470 7424-0/? E/Go: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x70776abca0]
2019-09-29 14:48:43.470 7424-0/? E/Go: goroutine 539 [running]:
2019-09-29 14:48:43.470 7424-0/? E/Go: github.com/lightningnetwork/lnd/lnwire.(*FeatureVector).HasFeature(...)
2019-09-29 14:48:43.471 7424-0/? E/Go:  /home/coco/gocode/src/github.com/lightningnetwork/lnd/lnwire/features.go:283
2019-09-29 14:48:43.471 7424-0/? E/Go: github.com/lightningnetwork/lnd.(*fundingManager).handleInitFundingMsg(0x40000d2ea0, 0x4001bb7d20)
2019-09-29 14:48:43.471 7424-0/? E/Go:  /home/coco/gocode/src/github.com/lightningnetwork/lnd/fundingmanager.go:2782 +0x370
2019-09-29 14:48:43.471 7424-0/? E/Go: github.com/lightningnetwork/lnd.(*fundingManager).reservationCoordinator(0x40000d2ea0)
2019-09-29 14:48:43.471 7424-0/? E/Go:  /home/coco/gocode/src/github.com/lightningnetwork/lnd/fundingmanager.go:757 +0x55c
2019-09-29 14:48:43.471 7424-0/? E/Go: created by github.com/lightningnetwork/lnd.(*fundingManager).start
2019-09-29 14:48:43.471 7424-0/? E/Go:  /home/coco/gocode/src/github.com/lightningnetwork/lnd/fundingmanager.go:552 +0x4d4

Looks like we are not checking whether the peer has completed the handshake before attempting to open a channel.

I am getting a similar error:

2019-10-01 16:14:41.909 [INF] FNDG: Initiating fundingRequest(local_amt=0.01028507 BTC (subtract_fees=true), push_amt=0 mSAT, chain_hash=000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943, peer=02d8add8c1b7172c0615caa9f025c469625a0504fbc2c22062c522bc0c6a277bef, dust_limit=0.00000573 BTC, min_confs=1)
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xe86e15]

goroutine 781 [running]:
github.com/lightningnetwork/lnd/lnwire.(*FeatureVector).HasFeature(...)
    github.com/lightningnetwork/lnd@/lnwire/features.go:283
github.com/lightningnetwork/lnd.(*fundingManager).handleInitFundingMsg(0xc000124480, 0xc001a7e560)
    github.com/lightningnetwork/lnd@/fundingmanager.go:2773 +0x435
github.com/lightningnetwork/lnd.(*fundingManager).reservationCoordinator(0xc000124480)
    github.com/lightningnetwork/lnd@/fundingmanager.go:753 +0x639
created by github.com/lightningnetwork/lnd.(*fundingManager).start
    github.com/lightningnetwork/lnd@/fundingmanager.go:548 +0x5b3
Was this page helpful?
0 / 5 - 0 ratings

Related issues

Roasbeef picture Roasbeef  路  3Comments

sunnya97 picture sunnya97  路  3Comments

ealymbaev picture ealymbaev  路  3Comments

Roasbeef picture Roasbeef  路  3Comments

anaoum picture anaoum  路  4Comments