ElementsProject / lightning

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

renepay: immediate crash #7150

Closed daywalker90 closed 6 months ago

daywalker90 commented 7 months ago

I'm on v24.02.1 and tried renepay on testnet and mainnet and on both i get this crash immediately:

Mar 15 14:55:57  lightningd[2544216]: DEBUG   plugin-cln-renepay: Starting renepay
Mar 15 14:55:57  lightningd[2544229]: cln-renepay: plugins/renepay/mcf.c:1412: get_flow_paths: Assertion `delta>0' failed.
Mar 15 14:55:57  lightningd[2544229]: cln-renepay: FATAL SIGNAL 6 (version v24.02-15-gb969ff3-modded)
Mar 15 14:55:57  lightningd[2544229]: 0x562c4a85ba44 send_backtrace
Mar 15 14:55:57  lightningd[2544229]:         common/daemon.c:33
Mar 15 14:55:57  lightningd[2544229]: 0x562c4a85bacc crashdump
Mar 15 14:55:57  lightningd[2544229]:         common/daemon.c:75
Mar 15 14:55:57  lightningd[2544229]: 0x7f9d43e6804f ???
Mar 15 14:55:57  lightningd[2544229]:         ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
Mar 15 14:55:57  lightningd[2544229]: 0x7f9d43eb6e2c __pthread_kill_implementation
Mar 15 14:55:57  lightningd[2544229]:         ./nptl/pthread_kill.c:44
Mar 15 14:55:57  lightningd[2544229]: 0x7f9d43e67fb1 __GI_raise
Mar 15 14:55:57  lightningd[2544229]:         ../sysdeps/posix/raise.c:26
Mar 15 14:55:57  lightningd[2544229]: 0x7f9d43e52471 __GI_abort
Mar 15 14:55:57  lightningd[2544229]:         ./stdlib/abort.c:79
Mar 15 14:55:57  lightningd[2544229]: 0x7f9d43e52394 __assert_fail_base
Mar 15 14:55:57  lightningd[2544229]:         ./assert/assert.c:92
Mar 15 14:55:57  lightningd[2544229]: 0x7f9d43e60eb1 __GI___assert_fail
Mar 15 14:55:57  lightningd[2544229]:         ./assert/assert.c:101
Mar 15 14:55:57  lightningd[2544229]: 0x562c4a845b6f get_flow_paths
Mar 15 14:55:57  lightningd[2544229]:         plugins/renepay/mcf.c:1412
Mar 15 14:55:57  lightningd[2544229]: 0x562c4a8463a5 minflow
Mar 15 14:55:57  lightningd[2544229]:         plugins/renepay/mcf.c:1716
Mar 15 14:55:57  lightningd[2544229]: 0x562c4a84000a add_payflows
Mar 15 14:55:57  lightningd[2544229]:         plugins/renepay/pay_flow.c:481
Mar 15 14:55:57  lightningd[2544229]: 0x562c4a83e83c try_paying
Mar 15 14:55:57  lightningd[2544229]:         plugins/renepay/pay.c:433
Mar 15 14:55:57  lightningd[2544229]: 0x562c4a83eaf9 listpeerchannels_done
Mar 15 14:55:57  lightningd[2544229]:         plugins/renepay/pay.c:511
Mar 15 14:55:57  lightningd[2544229]: 0x562c4a84ce1d handle_rpc_reply
Mar 15 14:55:57  lightningd[2544229]:         plugins/libplugin.c:961
Mar 15 14:55:57  lightningd[2544229]: 0x562c4a84cfc1 rpc_read_response_one
Mar 15 14:55:57  lightningd[2544229]:         plugins/libplugin.c:1148
Mar 15 14:55:57  lightningd[2544229]: 0x562c4a84d06e rpc_conn_read_response
Mar 15 14:55:57  lightningd[2544229]:         plugins/libplugin.c:1172
Mar 15 14:55:57  lightningd[2544229]: 0x562c4a87c85f next_plan
Mar 15 14:55:57  lightningd[2544229]:         ccan/ccan/io/io.c:59
Mar 15 14:55:57  lightningd[2544229]: 0x562c4a87cce6 do_plan
Mar 15 14:55:57  lightningd[2544229]:         ccan/ccan/io/io.c:407
Mar 15 14:55:57  lightningd[2544229]: 0x562c4a87cd7f io_ready
Mar 15 14:55:57  lightningd[2544229]:         ccan/ccan/io/io.c:417
Mar 15 14:55:57  lightningd[2544229]: 0x562c4a87e5dc io_loop
Mar 15 14:55:57  lightningd[2544229]:         ccan/ccan/io/poll.c:453
Mar 15 14:55:57  lightningd[2544229]: 0x562c4a84d3ed plugin_main
Mar 15 14:55:57  lightningd[2544229]:         plugins/libplugin.c:2086
Mar 15 14:55:57  lightningd[2544229]: 0x562c4a83ec22 main
Mar 15 14:55:57  lightningd[2544229]:         plugins/renepay/pay.c:1429
Mar 15 14:55:57  lightningd[2544229]: 0x7f9d43e53249 __libc_start_call_main
Mar 15 14:55:57  lightningd[2544229]:         ../sysdeps/nptl/libc_start_call_main.h:58
Mar 15 14:55:57  lightningd[2544229]: 0x7f9d43e53304 __libc_start_main_impl
Mar 15 14:55:57  lightningd[2544229]:         ../csu/libc-start.c:360
Mar 15 14:55:57  lightningd[2544229]: 0x562c4a83ba50 ???
Mar 15 14:55:57  lightningd[2544229]:         ???:0
Mar 15 14:55:57  lightningd[2544229]: 0xffffffffffffffff ???
Mar 15 14:55:57  lightningd[2544229]:         ???:0
Mar 15 14:55:57  lightningd[2544229]: cln-renepay: FATAL SIGNAL 11 (version v24.02-15-gb969ff3-modded)
Mar 15 14:55:57  lightningd[2544229]: 0x562c4a85ba44 send_backtrace
Mar 15 14:55:57  lightningd[2544229]:         common/daemon.c:33
Mar 15 14:55:57  lightningd[2544229]: 0x562c4a85bacc crashdump
Mar 15 14:55:57  lightningd[2544229]:         common/daemon.c:75
Mar 15 14:55:57  lightningd[2544229]: 0x7f9d43e6804f ???
Mar 15 14:55:57  lightningd[2544229]:         ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
Mar 15 14:55:57  lightningd[2544229]: 0x0 ???
Mar 15 14:55:57  lightningd[2544229]:         ???:0
Mar 15 14:55:57  lightningd[2544216]: INFO    plugin-cln-renepay: Killing plugin: exited during normal operation

example testnet invoice where this happened:

lntb10m1pjlg56lsp5lz998xhafnqg7u08mjnk45lp0ncm0cmztashndmhgjpgky8u24mspp5lgrrlx65rppx5g534qsmrfll30csrvqlxg9r6qcn9qdl4ds5q26qdql2djkuepqw3hjqsj5gvsxzerywfjhxucxqyp2xqcqzyl9qxpqysgqm7shx994xzahj30eytr9z40n05f7hcxnyw2q3pq9k8u6cjwg3cexcxm7atjgp5ykwc4jqydagwkxvstystyr2axjf2yltgh9f5xgh2qpqwmch6
Lagrang3 commented 7 months ago

It seems that the path-finder hit a channel with htlc_max=0. I believe there is no other explanation. Does that make sense?

Lagrang3 commented 7 months ago

I can patch this by disabling channels with htlc_max less than some threshold. Let me investigate.

daywalker90 commented 7 months ago

It seems that the path-finder hit a channel with htlc_max=0. I believe there is no other explanation. Does that make sense?

Oh yes i have some of those

daywalker90 commented 7 months ago

I'm not sure in what context this is but be aware of the behaviour of pay here: "Note that htlcmax only applies to forwarded HTLCs: we can still send larger payments ourselves." (from setchannel)

Lagrang3 commented 7 months ago

I was able to reproduce this and patch it when a local channel has htlcmax=0. @daywalker90, thanks for reporting!