Skip to content

Testnet channel 1451585x82x0 crashes routing #3517

@s-tikhomirov

Description

@s-tikhomirov

Issue and Steps to Reproduce

I understand that this quite an edge case, still I'd like my lightningd not to crash.

I'm calling getroute from a plugin to find a route between src and dst. For my purposes, I put many restrictions on getroute for it to return the specific channel between the two nodes. Among other calls, I call getroute where the very channel between src and dst is excluded, and maxhops = 1. I expect it to either return with "No route found", or return a parallel channel between src and dst if one exists.

For one particular channel on Bitcoin testnet, I run into problems:

2020-02-13T12:28:22.131Z **BROKEN** gossipd: FATAL SIGNAL 6 (version v0.8.0-40-g899f5de)
2020-02-13T12:28:22.132Z **BROKEN** gossipd: backtrace: common/daemon.c:46 (send_backtrace) 0x55fdc9118576
2020-02-13T12:28:22.132Z **BROKEN** gossipd: backtrace: common/daemon.c:54 (crashdump) 0x55fdc91185c1
2020-02-13T12:28:22.132Z **BROKEN** gossipd: backtrace: (null):0 ((null)) 0x7f82920a5f1f
2020-02-13T12:28:22.132Z **BROKEN** gossipd: backtrace: (null):0 ((null)) 0x7f82920a5e97
2020-02-13T12:28:22.132Z **BROKEN** gossipd: backtrace: (null):0 ((null)) 0x7f82920a7800
2020-02-13T12:28:22.132Z **BROKEN** gossipd: backtrace: (null):0 ((null)) 0x7f8292097399
2020-02-13T12:28:22.132Z **BROKEN** gossipd: backtrace: (null):0 ((null)) 0x7f8292097411
2020-02-13T12:28:22.132Z **BROKEN** gossipd: backtrace: gossipd/routing.c:1223 (find_shorter_route) 0x55fdc911166c
2020-02-13T12:28:22.132Z **BROKEN** gossipd: backtrace: gossipd/routing.c:1353 (find_route) 0x55fdc911207e
2020-02-13T12:28:22.132Z **BROKEN** gossipd: backtrace: gossipd/routing.c:2687 (get_route) 0x55fdc91134b8
2020-02-13T12:28:22.132Z **BROKEN** gossipd: backtrace: gossipd/gossipd.c:919 (getroute_req) 0x55fdc910957f
2020-02-13T12:28:22.132Z **BROKEN** gossipd: backtrace: gossipd/gossipd.c:1552 (recv_req) 0x55fdc910b30d
2020-02-13T12:28:22.132Z **BROKEN** gossipd: backtrace: common/daemon_conn.c:31 (handle_read) 0x55fdc91186b0
2020-02-13T12:28:22.132Z **BROKEN** gossipd: backtrace: ccan/ccan/io/io.c:59 (next_plan) 0x55fdc9136ba1
2020-02-13T12:28:22.132Z **BROKEN** gossipd: backtrace: ccan/ccan/io/io.c:407 (do_plan) 0x55fdc9137090
2020-02-13T12:28:22.132Z **BROKEN** gossipd: backtrace: ccan/ccan/io/io.c:417 (io_ready) 0x55fdc91370bd
2020-02-13T12:28:22.132Z **BROKEN** gossipd: backtrace: ccan/ccan/io/poll.c:445 (io_loop) 0x55fdc9138989
2020-02-13T12:28:22.132Z **BROKEN** gossipd: backtrace: gossipd/gossipd.c:1666 (main) 0x55fdc910b600
2020-02-13T12:28:22.132Z INFO 0303ba0fed62039df562a77bfcec887a9aa0767ff6519f6e2baa1309210544cd3d-channeld-chan#7: Peer connection lost
2020-02-13T12:28:22.133Z INFO 0303ba0fed62039df562a77bfcec887a9aa0767ff6519f6e2baa1309210544cd3d-chan#7: Peer transient failure in CHANNELD_NORMAL: channeld: Owning subdaemon channeld died (62208)
2020-02-13T12:28:22.133Z INFO 0277622bf4c497475960bf91bd3c673a4cb4e9b589cebfde9700c197b3989cc1b8-channeld-chan#8: Peer connection lost
2020-02-13T12:28:22.133Z INFO 0277622bf4c497475960bf91bd3c673a4cb4e9b589cebfde9700c197b3989cc1b8-chan#8: Peer transient failure in CHANNELD_NORMAL: channeld: Owning subdaemon channeld died (62208)
2020-02-13T12:28:22.133Z **BROKEN** gossipd: backtrace: (null):0 ((null)) 0x7f8292088b96
2020-02-13T12:28:22.133Z **BROKEN** gossipd: backtrace: (null):0 ((null)) 0x55fdc9105299
2020-02-13T12:28:22.133Z **BROKEN** gossipd: backtrace: (null):0 ((null)) 0xffffffffffffffff
2020-02-13T12:28:22.133Z **BROKEN** gossipd: FATAL SIGNAL (version v0.8.0-40-g899f5de)
2020-02-13T12:28:22.133Z **BROKEN** gossipd: backtrace: common/daemon.c:46 (send_backtrace) 0x55fdc9118576
2020-02-13T12:28:22.133Z **BROKEN** gossipd: backtrace: common/status.c:206 (status_failed) 0x55fdc911ba28
2020-02-13T12:28:22.133Z **BROKEN** gossipd: backtrace: common/subdaemon.c:25 (status_backtrace_exit) 0x55fdc911bb20
2020-02-13T12:28:22.133Z **BROKEN** gossipd: backtrace: common/daemon.c:57 (crashdump) 0x55fdc91185c7
2020-02-13T12:28:22.133Z **BROKEN** gossipd: backtrace: (null):0 ((null)) 0x7f82920a5f1f
2020-02-13T12:28:22.133Z **BROKEN** gossipd: backtrace: (null):0 ((null)) 0x7f82920a5e97
2020-02-13T12:28:22.133Z **BROKEN** gossipd: backtrace: (null):0 ((null)) 0x7f82920a7800
2020-02-13T12:28:22.133Z **BROKEN** gossipd: backtrace: (null):0 ((null)) 0x7f8292097399
2020-02-13T12:28:22.133Z **BROKEN** gossipd: backtrace: (null):0 ((null)) 0x7f8292097411
2020-02-13T12:28:22.133Z **BROKEN** gossipd: backtrace: gossipd/routing.c:1223 (find_shorter_route) 0x55fdc911166c
2020-02-13T12:28:22.134Z **BROKEN** gossipd: backtrace: gossipd/routing.c:1353 (find_route) 0x55fdc911207e
2020-02-13T12:28:22.134Z **BROKEN** gossipd: backtrace: gossipd/routing.c:2687 (get_route) 0x55fdc91134b8
2020-02-13T12:28:22.134Z **BROKEN** gossipd: backtrace: gossipd/gossipd.c:919 (getroute_req) 0x55fdc910957f
2020-02-13T12:28:22.134Z **BROKEN** gossipd: backtrace: gossipd/gossipd.c:1552 (recv_req) 0x55fdc910b30d
2020-02-13T12:28:22.134Z **BROKEN** gossipd: backtrace: common/daemon_conn.c:31 (handle_read) 0x55fdc91186b0
2020-02-13T12:28:22.134Z **BROKEN** gossipd: backtrace: ccan/ccan/io/io.c:59 (next_plan) 0x55fdc9136ba1
2020-02-13T12:28:22.134Z **BROKEN** gossipd: backtrace: ccan/ccan/io/io.c:407 (do_plan) 0x55fdc9137090
2020-02-13T12:28:22.134Z **BROKEN** gossipd: backtrace: ccan/ccan/io/io.c:417 (io_ready) 0x55fdc91370bd
2020-02-13T12:28:22.134Z **BROKEN** gossipd: backtrace: ccan/ccan/io/poll.c:445 (io_loop) 0x55fdc9138989
2020-02-13T12:28:22.134Z **BROKEN** gossipd: backtrace: gossipd/gossipd.c:1666 (main) 0x55fdc910b600
2020-02-13T12:28:22.134Z **BROKEN** gossipd: backtrace: (null):0 ((null)) 0x7f8292088b96
2020-02-13T12:28:22.134Z **BROKEN** gossipd: backtrace: (null):0 ((null)) 0x55fdc9105299
2020-02-13T12:28:22.134Z **BROKEN** gossipd: backtrace: (null):0 ((null)) 0xffffffffffffffff
2020-02-13T12:28:22.134Z **BROKEN** gossipd: STATUS_FAIL_INTERNAL_ERROR: FATAL SIGNAL

I isolated the problem, this is the function which when called from a plugin produces the above effect (with smaller amount it's OK):

@plugin.method("test")
def test_crash(plugin, channel_id="1451585x82x0"):
    channel_pair = plugin.rpc.listchannels(channel_id)["channels"]
    src = channel_pair[0]["source"]
    dst = channel_pair[0]["destination"]
    exclude = [channel_id+"/0", channel_id+"/1"]
    amount =  4294840000 # crashes in /1
    #amount =  4294830000 # OK
    print("Finding route in /0")
    try:
        route = plugin.rpc.getroute(dst, amount, riskfactor=1, 
            fromid=src, exclude=exclude, maxhops=1)["route"]
    except RpcError as e:
        print(e)
        pass
    print("Finding route in /1")
    try:
        route = plugin.rpc.getroute(src, amount, riskfactor=1, 
            fromid=dst, exclude=exclude, maxhops=1)["route"]
    except RpcError as e:
        print(e)
        pass
    return

Note that my node is connected to 1451585x82x0's source (0277622bf4c497475960bf91bd3c673a4cb4e9b589cebfde9700c197b3989cc1b8) but not to destination (03367c6e59a9924d2eb188ce43413dd6c76db102c3c0516d51ccea324b490e3bfa). I'm also connected to 0303ba0fed62039df562a77bfcec887a9aa0767ff6519f6e2baa1309210544cd3d (its ID also appears in the crash trace).

getinfo output

{
   "id": "026e7cb4237b4042db75a991af29c2d7704780c8e7fbebe5fdbad8f38e958dfba5",
   "alias": "clightningM",
   "color": "026e7c",
   "num_peers": 5,
   "num_pending_channels": 0,
   "num_active_channels": 3,
   "num_inactive_channels": 3,
   "address": [],
   "binding": [
      {
         "type": "ipv4",
         "address": "127.0.0.1",
         "port": 9737
      }
   ],
   "version": "v0.8.0-40-g899f5de",
   "blockheight": 1665789,
   "network": "testnet",
   "msatoshi_fees_collected": 0,
   "fees_collected_msat": "0msat",
   "lightning-dir": "/home/sergei/.lightning/testnet"
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions