Skip to content

lightningd: wait for all plugins to gracefully shutdown#9000

Open
ThomsenDrake wants to merge 1 commit intoElementsProject:masterfrom
ThomsenDrake:fix/plugin-graceful-shutdown-7697
Open

lightningd: wait for all plugins to gracefully shutdown#9000
ThomsenDrake wants to merge 1 commit intoElementsProject:masterfrom
ThomsenDrake:fix/plugin-graceful-shutdown-7697

Conversation

@ThomsenDrake
Copy link
Copy Markdown

@ThomsenDrake ThomsenDrake commented Mar 28, 2026

Fixes #7697\n\nChangelog-Changed: lightningd now waits for all running plugins to gracefully shutdown before exiting.\n\nWhen multiple plugins are shutting down and one exits before others,\nio_loop() can return early (e.g. when num_fds drops to 0), causing\nremaining plugins to be killed immediately instead of being given their\nfull 30-second grace period.\n\nFix by wrapping io_loop() in a while loop that continues as long as\nplugins are still alive, only breaking when the timer expires.\n\nThe fix is minimal (7 lines changed) and follows the existing code\npattern. No new state tracking needed — the plugin list already\ncorrectly tracks which plugins are alive.

When multiple plugins are shutting down and one exits before others,
io_loop() can return early (e.g. when num_fds drops to 0), causing
remaining plugins to be killed immediately instead of being given their
full 30-second grace period.

Fix by wrapping io_loop() in a while loop that continues as long as
plugins are still alive, only breaking when the timer expires.

Fixes ElementsProject#7697

Changelog-Fixed: Plugins: now wait for all plugins to gracefully shutdown instead of killing remaining plugins when one exits first. ([ElementsProject#7697])
@madelinevibes madelinevibes added the BOUNTY! 🫰 A bounty is available for this PR label Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BOUNTY! 🫰 A bounty is available for this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feature: Should wait for plugins to gracefully shutdown

2 participants