Skip to content

Commit

Permalink
lightningd: don't timeout plugins if init is slow!
Browse files Browse the repository at this point in the history
This is a minimal fix: we wait until all plugins reply from init before
continuing.  Really large or busy nodes can have other things monopolize
lightningd, then the timer goes off and we blame the plugin (which has
responded, we just haven't read it yet!).

The real answer is to have some timeouts only advance when we're idle,
or have them low-priority so we only activate them when we're idle (this
doesn't apply to all timers: some are probably important!).  But
this is a minimal fix for -rc3.

Fixes: #5736
Changelog-Fixed: plugins: on large/slow nodes we could blame plugins for failing to answer init in time, when we were just slow.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
rustyrussell committed Nov 26, 2022
1 parent 3d311c9 commit a418a46
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lightningd/plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ static void check_plugins_initted(struct plugins *plugins)
for (size_t i = 0; i < tal_count(plugin_cmds); i++)
plugin_cmd_all_complete(plugins, plugin_cmds[i]);
tal_free(plugin_cmds);

if (plugins->startup)
io_break(plugins);
}

struct command_result *plugin_register_all_complete(struct lightningd *ld,
Expand Down Expand Up @@ -1943,6 +1946,11 @@ void plugins_config(struct plugins *plugins)
plugin_config(p);
}

/* Wait for them to configure, before continuing: large
* nodes can take a while to startup! */
if (plugins->startup)
io_loop_with_timers(plugins->ld);

plugins->startup = false;
}

Expand Down

0 comments on commit a418a46

Please sign in to comment.