ElementsProject / lightning

Core Lightning — Lightning Network implementation focusing on spec compliance and performance
Other
2.81k stars 889 forks source link

crash on `close` #4575

Open niftynei opened 3 years ago

niftynei commented 3 years ago

Attempted to close an existing channel (so i could try opening a new one) and it went boom.

Channel was previously established/re-init'd from disk.

zircon:lightning (nifty/fix-4562)$ l1-cli fundchannel_start 03fce775508719e4064b7f19d4e884ddaf51db23bbfc560286ce872f9ed106fee0 10000 253perkw
{
   "code": -1,
   "message": "Peer already CHANNELD_NORMAL"
}
zircon:lightning (nifty/fix-4562)$ l1-cli close 03fce775508719e4064b7f19d4e884ddaf51db23bbfc560286ce872f9ed106fee0
lightning-cli: reading response: socket closed
2021-06-01T19:40:39.470Z **BROKEN** lightningd: FATAL SIGNAL 6 (version v0.10.0-266-g0ed7c0d-modded)
2021-06-01T19:40:39.470Z **BROKEN** lightningd: backtrace: common/daemon.c:44 (send_backtrace) 0x555cc71b8b0e
2021-06-01T19:40:39.470Z **BROKEN** lightningd: backtrace: common/daemon.c:52 (crashdump) 0x555cc71b8b62
2021-06-01T19:40:39.470Z **BROKEN** lightningd: backtrace: (null):0 ((null)) 0x7fedb1c0e20f
2021-06-01T19:40:39.470Z **BROKEN** lightningd: backtrace: (null):0 ((null)) 0x7fedb1c0e18b
2021-06-01T19:40:39.470Z **BROKEN** lightningd: backtrace: (null):0 ((null)) 0x7fedb1bed858
2021-06-01T19:40:39.470Z **BROKEN** lightningd: backtrace: (null):0 ((null)) 0x7fedb1bed728
2021-06-01T19:40:39.470Z **BROKEN** lightningd: backtrace: (null):0 ((null)) 0x7fedb1bfef35
2021-06-01T19:40:39.470Z **BROKEN** lightningd: backtrace: lightningd/lightningd.c:714 (on_sigchild) 0x555cc715f863
2021-06-01T19:40:39.470Z **BROKEN** lightningd: backtrace: (null):0 ((null)) 0x7fedb1c0e20f
2021-06-01T19:40:39.470Z **BROKEN** lightningd: backtrace: (null):0 ((null)) 0x7fedb1cddac7
2021-06-01T19:40:39.470Z **BROKEN** lightningd: backtrace: common/daemon.c:95 (daemon_poll) 0x555cc71b8ccd
2021-06-01T19:40:39.470Z **BROKEN** lightningd: backtrace: lightningd/lightningd.c:668 (io_poll_lightningd) 0x555cc715f724
2021-06-01T19:40:39.470Z **BROKEN** lightningd: backtrace: ccan/ccan/io/poll.c:412 (io_loop) 0x555cc7215aad
2021-06-01T19:40:39.470Z **BROKEN** lightningd: backtrace: lightningd/io_loop_with_timers.c:24 (io_loop_with_timers) 0x555cc715a437
2021-06-01T19:40:39.470Z **BROKEN** lightningd: backtrace: lightningd/lightningd.c:1111 (main) 0x555cc71602a8
2021-06-01T19:40:39.470Z **BROKEN** lightningd: backtrace: (null):0 ((null)) 0x7fedb1bef0b2
2021-06-01T19:40:39.470Z **BROKEN** lightningd: backtrace: (null):0 ((null)) 0x555cc713a03d
2021-06-01T19:40:39.470Z **BROKEN** lightningd: backtrace: (null):0 ((null)) 0xffffffffffffffff

Restarted the node, looks like it reached the correct closed state.

{
   "peers": [
      {
         "id": "03fce775508719e4064b7f19d4e884ddaf51db23bbfc560286ce872f9ed106fee0",
         "connected": false,
         "channels": [
            {
               "state": "CLOSINGD_COMPLETE",
               "scratch_txid": "557e3814b7f79daa121c96374aa15612ed31ef07e3201d20d47ad100663fafd7",
               "last_tx_fee": "284000msat",
               "feerate": {
                  "perkw": 253,
                  "perkb": 1012
               },
               "short_channel_id": "976x1x0",
               "direction": 0,
               "channel_id": "1c2d480dd495bce9b47c6fddd3ff7986805df4ec17fa92ca9698b4a97ced5a43",
               "funding_txid": "fec3474592b912ac4443c33d5738bd7b8b16fb7418944b692adbd4d3cfacabf7",
               "close_to_addr": "bcrt1q9tt7lgutvr9hct9yymmdz7gtn4mej8hz8zzqtr",
               "close_to": "00142ad7efa38b60cb7c2ca426f6d1790b9d77991ee2",
               "private": false,
               "opener": "local",
               "closer": "local",
               "features": [
                  "option_static_remotekey",
                  "option_anchor_outputs"
               ],
               "funding_allocation_msat": {
                  "03fce775508719e4064b7f19d4e884ddaf51db23bbfc560286ce872f9ed106fee0": 0,
                  "03bdba5157a8c2b938b5f0613e06c3b2bb29acd78e19e3da1cf0ca7b734bebe350": 30000000
               },
               "funding_msat": {
                  "03fce775508719e4064b7f19d4e884ddaf51db23bbfc560286ce872f9ed106fee0": "0msat",
                  "03bdba5157a8c2b938b5f0613e06c3b2bb29acd78e19e3da1cf0ca7b734bebe350": "30000000msat"
               },
               "msatoshi_to_us": 30000000,
               "to_us_msat": "30000000msat",
               "msatoshi_to_us_min": 30000000,
               "min_to_us_msat": "30000000msat",
               "msatoshi_to_us_max": 30000000,
               "max_to_us_msat": "30000000msat",
               "msatoshi_total": 30000000,
               "total_msat": "30000000msat",
               "fee_base_msat": "1msat",
               "fee_proportional_millionths": 10,
               "dust_limit_satoshis": 546,
               "dust_limit_msat": "546000msat",
               "max_htlc_value_in_flight_msat": 18446744073709551615,
               "max_total_htlc_in_msat": "18446744073709551615msat",
               "their_channel_reserve_satoshis": 546,
               "their_reserve_msat": "546000msat",
               "our_channel_reserve_satoshis": 546,
               "our_reserve_msat": "546000msat",
               "spendable_msatoshi": 28052000,
               "spendable_msat": "28052000msat",
               "receivable_msatoshi": 0,
               "receivable_msat": "0msat",
               "htlc_minimum_msat": 0,
               "minimum_htlc_in_msat": "0msat",
               "their_to_self_delay": 6,
               "our_to_self_delay": 6,
               "max_accepted_htlcs": 483,
               "state_changes": [
                  {
                     "timestamp": "2021-05-29T18:33:31.834Z",
                     "old_state": "DUALOPEND_OPEN_INIT",
                     "new_state": "DUALOPEND_AWAITING_LOCKIN",
                     "cause": "user",
                     "message": "Sigs exchanged, waiting for lock-in"
                  },
                  {
                     "timestamp": "2021-05-29T18:33:40.407Z",
                     "old_state": "DUALOPEND_AWAITING_LOCKIN",
                     "new_state": "CHANNELD_NORMAL",
                     "cause": "user",
                     "message": "Lockin complete"
                  },
                  {
                     "timestamp": "2021-06-01T19:40:34.243Z",
                     "old_state": "CHANNELD_NORMAL",
                     "new_state": "CHANNELD_SHUTTING_DOWN",
                     "cause": "user",
                     "message": "User or plugin invoked close command"
                  },
                  {
                     "timestamp": "2021-06-01T19:40:34.276Z",
                     "old_state": "CHANNELD_SHUTTING_DOWN",
                     "new_state": "CLOSINGD_SIGEXCHANGE",
                     "cause": "user",
                     "message": "Start closingd"
                  },
                  {
                     "timestamp": "2021-06-01T19:46:26.768Z",
                     "old_state": "CLOSINGD_SIGEXCHANGE",
                     "new_state": "CLOSINGD_COMPLETE",
                     "cause": "user",
                     "message": "Closing complete"
                  }
               ],
               "status": [
                  "CLOSINGD_SIGEXCHANGE:We agreed on a closing fee of 284 satoshi for tx:557e3814b7f79daa121c96374aa15612ed31ef07e3201d20d47ad100663fafd7"
               ],
               "in_payments_offered": 0,
               "in_msatoshi_offered": 0,
               "in_offered_msat": "0msat",
               "in_payments_fulfilled": 0,
               "in_msatoshi_fulfilled": 0,
               "in_fulfilled_msat": "0msat",
               "out_payments_offered": 0,
               "out_msatoshi_offered": 0,
               "out_offered_msat": "0msat",
               "out_payments_fulfilled": 0,
               "out_msatoshi_fulfilled": 0,
               "out_fulfilled_msat": "0msat",
               "htlcs": []
            }
         ]
      }
   ]
}
rustyrussell commented 3 years ago

I cannot figure out how this happens, but I've put in a diagnostic so we can know what the errno was if it happens again!