Skip to content

Commit cac2012

Browse files
committed
lightningd: don't crash if replaying blocks for onchaind during shutdown.
``` lightningd-1 2024-11-15T04:06:47.660Z UNUSUAL lightningd: JSON-RPC shutdown lightningd-1 2024-11-15T04:06:47.665Z DEBUG lightningd: io_break: start_json_stream lightningd-1 2024-11-15T04:06:47.666Z DEBUG lightningd: io_loop_with_timers: main lightningd-1 2024-11-15T04:06:47.672Z DEBUG connectd: REPLY WIRE_CONNECTD_START_SHUTDOWN_REPLY with 0 fds lightningd-1 2024-11-15T04:06:47.674Z DEBUG lightningd: io_break: connectd_start_shutdown_reply lightningd-1 2024-11-15T04:06:47.680Z DEBUG 022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-onchaind-chan#1: Status closed, but not exited. Killing lightningd-1 2024-11-15T04:06:47.715Z **BROKEN** lightningd: FATAL SIGNAL 11 (version e627dbf-modded) ------------------------------- Valgrind errors -------------------------------- Valgrind error file: valgrind-errors.43310 ==43310== Invalid read of size 8 ==43310== at 0x1B5717: subd_send_msg (subd.c:842) ==43310== by 0x17563A: onchain_tx_depth (onchain_control.c:177) ==43310== by 0x175E92: replay_block (onchain_control.c:391) ==43310== by 0x12E30C: getrawblockbyheight_callback (bitcoind.c:506) ==43310== by 0x1A5AC0: plugin_response_handle (plugin.c:663) ==43310== by 0x1A5D3C: plugin_read_json_one (plugin.c:775) ==43310== by 0x1A5F79: plugin_read_json (plugin.c:826) ==43310== by 0x38F320: next_plan (io.c:60) ==43310== by 0x38FF76: do_plan (io.c:422) ==43310== by 0x38FFDD: io_ready (io.c:439) ==43310== by 0x392411: io_loop (poll.c:455) ==43310== by 0x1AB630: shutdown_plugins (plugin.c:2588) ==43310== Address 0x58 is not stack'd, malloc'd or (recently) free'd ==43310== ``` Signed-off-by: Rusty Russell <[email protected]>
1 parent 102e223 commit cac2012

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lightningd/onchain_control.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,10 @@ static void replay_block(struct bitcoind *bitcoind,
383383
struct replay_tx *rtx;
384384
struct replay_tx_hash_iter rit;
385385

386+
/* If we're shutting down, this can happen! */
387+
if (!channel->owner)
388+
return;
389+
386390
/* Tell onchaind that all existing txs have reached a new depth */
387391
for (rtx = replay_tx_hash_first(channel->onchaind_replay_watches, &rit);
388392
rtx;

0 commit comments

Comments
 (0)