From 6c335dfcc64b5e4498fde003ef83716ea5e2d865 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 24 Jul 2019 14:28:53 +0930 Subject: [PATCH] plugins: don't crash if getmanifest times out. I mean, we still crash, but we give an error now :) lightningd: FATAL SIGNAL 11 (version v0.7.1-82-g92c38a0) 0x5592e75e19c8 send_backtrace common/daemon.c:40 0x5592e75e1a6e crashdump common/daemon.c:53 0x7fad1514ef5f ??? ???:0 0x5592e75b2f3a io_loop_with_timers lightningd/io_loop_with_timers.c:29 0x5592e75d8a54 plugins_init lightningd/plugin.c:1018 0x5592e75b8e22 main lightningd/lightningd.c:671 0x7fad15131b6a ??? ???:0 0x5592e75a10f9 ??? ???:0 0xffffffffffffffff ??? ???:0 Segmentation fault (core dumped) Signed-off-by: Rusty Russell --- lightningd/io_loop_with_timers.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lightningd/io_loop_with_timers.c b/lightningd/io_loop_with_timers.c index e1e9d7002..f2b0165a5 100644 --- a/lightningd/io_loop_with_timers.c +++ b/lightningd/io_loop_with_timers.c @@ -26,9 +26,12 @@ void *io_loop_with_timers(struct lightningd *ld) /*~ Notice that timers are called here in the event loop like * anything else, so there are no weird concurrency issues. */ if (expired) { - db_begin_transaction(ld->wallet->db); + /* This routine is legal in early startup, too. */ + if (ld->wallet) + db_begin_transaction(ld->wallet->db); timer_expired(ld, expired); - db_commit_transaction(ld->wallet->db); + if (ld->wallet) + db_commit_transaction(ld->wallet->db); } }