thesimplekid / cln-zapper-rs

Core Lightning plugin for sending zap (NIP-57) notes
BSD 3-Clause "New" or "Revised" License
13 stars 4 forks source link

Graceful shutdown/cleanup on CLN stop #6

Open elsirion opened 3 weeks ago

elsirion commented 3 weeks ago

I was made aware that clnurl didn't shutdown correctly when CLN did and recently fixed it (https://github.com/elsirion/clnurl/issues/14). @laanwj mentioned cln-zapper likely needs the same fix. Just for awareness :)

thesimplekid commented 3 weeks ago

Thank you I'll take a look

laanwj commented 3 weeks ago

It does seem like a different problem; the plugin receives and handles the shutdown signal, and even logs a message, but subsequently it doesn't really exit. My guess is it doesn't stop processing the invoices stream in the main thread.

Edit: the problem may actually be in cln-rpc: from what i'm noticing, it looks like the call await never returns in case the RPC network connection is disconnected which happens on shutdown. No, the error is returned fine, but it loops every second on error. Network errors should be handled differently than RPC errors.