Skip to content

Conversation

@Lagrang3
Copy link
Collaborator

@Lagrang3 Lagrang3 commented Oct 31, 2024

When trying to subscribe renepay to an rpc_command hook I noticed the initialization of the plugins will time out.
It seems that at initialization we have a recursive hook call that keeps lightningd hooked to synchronous communication with the subscriber. By letting hooks apply only after plugin startup the problem is fixed.

Changelog-Fixed: lightningd: fixes rpc_command hooks causing a infinite io loop at plugin initialization

When trying to subscribe renepay to an rpc_command hook I noticed
the initialization of the plugins will time out.
It seems that at initialization we have a recursive hook call
that keeps lightningd hooked to synchronous communication with the subscriber.
By letting hooks apply on after plugin startup the problem is fixed.

Changelog-Fixed: lightningd: fixes rpc_command hooks causing a infinite io loop at plugin initialization

Signed-off-by: Lagrang3 <[email protected]>
@Lagrang3 Lagrang3 requested a review from rustyrussell October 31, 2024 11:57
Copy link
Collaborator

@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

YAY

ACK 49e7dcd

@rustyrussell
Copy link
Contributor

rustyrussell commented Nov 1, 2024

I have a more general fix, though this isn't bad in itself. This won't work for plugins which are started after initialization, however.

See #7750

@Lagrang3
Copy link
Collaborator Author

I am closing this since the new libplugin interface passes a struct command to the init function that can be used to
query lightningd asynchronously at plugin's startup. To subscribe to rpc_command hook we just don't call rpc_scan.

@Lagrang3 Lagrang3 closed this Nov 18, 2024
@Lagrang3 Lagrang3 deleted the fix-rpc-command-hook branch December 2, 2024 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants