Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLN plugin does not gracefully exit #307

Open
Impa10r opened this issue Sep 5, 2024 · 8 comments · May be fixed by #318
Open

CLN plugin does not gracefully exit #307

Impa10r opened this issue Sep 5, 2024 · 8 comments · May be fixed by #318

Comments

@Impa10r
Copy link
Contributor

Impa10r commented Sep 5, 2024

It should subscribe to shutdown event notification to know when lightningd is about to stop. Otherwise, this happens:

Sep  4 13:53:58 vlad-VirtualBox systemd[1]: Stopping Core Lightning daemon...
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Deactivated successfully.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 18447 (peerswap) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 18472 (lightning_conne) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 18539 (peerswap) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 18564 (lightning_conne) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 18590 (peerswap) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 18614 (lightning_hsmd) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 18615 (lightning_conne) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 18639 (peerswap) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 18662 (lightning_hsmd) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 18663 (lightning_conne) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 18784 (peerswap) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 18851 (lightning_hsmd) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 18856 (lightning_conne) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 18936 (peerswap) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 18959 (lightning_conne) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 18982 (peerswap) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 19006 (lightning_hsmd) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 19007 (lightning_conne) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 19064 (peerswap) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 19089 (lightning_hsmd) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 19090 (lightning_conne) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 19181 (peerswap) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 19270 (lightning_hsmd) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 19274 (lightning_conne) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 19343 (peerswap) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 19365 (lightning_hsmd) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 19366 (lightning_conne) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 19417 (peerswap) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 19441 (lightning_conne) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 19628 (peerswap) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 19739 (lightning_conne) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 19784 (lightning_hsmd) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 29117 (peerswap) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 29243 (lightning_conne) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 29318 (peerswap) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 29377 (lightning_conne) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 29402 (peerswap) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 29425 (lightning_conne) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 29483 (peerswap) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 29640 (lightning_hsmd) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 29656 (lightning_conne) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 29745 (peerswap) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 29863 (lightning_conne) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 29993 (lightning_hsmd) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 30607 (lightning_hsmd) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 40975 (peerswap) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 41065 (lightning_hsmd) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 41069 (lightning_conne) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 41130 (peerswap) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 41155 (lightning_hsmd) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 41157 (lightning_conne) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 41239 (peerswap) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 41380 (lightning_conne) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 41417 (peerswap) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 41437 (lightning_hsmd) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 41438 (lightning_conne) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 41498 (peerswap) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 41606 (lightning_hsmd) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 41622 (lightning_conne) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 41739 (peerswap) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 41760 (lightning_hsmd) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 41761 (lightning_conne) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 41787 (peerswap) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 41857 (lightning_conne) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 52016 (peerswap) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 52038 (lightning_hsmd) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 52041 (lightning_conne) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 52100 (peerswap) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 52300 (lightning_conne) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 52383 (lightning_hsmd) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 52497 (lightning_gossi) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 99981 (lightning_hsmd) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 139787 (peerswap) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 140812 (peerswap) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 140893 (peerswap) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 140947 (bcli) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 140948 (commando) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 140949 (fetchinvoice) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 140950 (funder) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 140951 (topology) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 140952 (keysend) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 140953 (offers) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 140954 (pay) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 140956 (txprepare) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 140957 (cln-renepay) remains running after unit stopped.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: Stopped Core Lightning daemon.
Sep  4 13:53:59 vlad-VirtualBox systemd[1]: lightningd.service: Consumed 37.782s CPU time.
@YusukeShimizu
Copy link
Contributor

Thank you.
Will have a look at it very soon.

@YusukeShimizu
Copy link
Contributor

Confirmed.
It is necessary to add a shutdown hook to glightning and add to peerswap.
I will address these.

@YusukeShimizu YusukeShimizu linked a pull request Sep 23, 2024 that will close this issue
@YusukeShimizu
Copy link
Contributor

Could you please check if it functions as expected with the build from this PR when you have a moment?
#318

@Impa10r
Copy link
Contributor Author

Impa10r commented Sep 24, 2024

Could you please check if it functions as expected with the build from this PR when you have a moment? #318

Hi, I am sure peerswap shuts down gracefully, but CLN 24.08.1 checks too early. It should give 30 seconds, but gives 0:

sep 24 12:43:56 vlad-VirtualBox systemd[1]: Started Core Lightning daemon.
sep 24 12:44:53 vlad-VirtualBox systemd[1]: Stopping Core Lightning daemon...
sep 24 12:44:53 vlad-VirtualBox lightningd[584546]: Lost connection to the RPC socket.
sep 24 12:44:53 vlad-VirtualBox lightningd[584550]: Lost connection to the RPC socket.
sep 24 12:44:53 vlad-VirtualBox lightningd[584549]: Lost connection to the RPC socket.
sep 24 12:44:53 vlad-VirtualBox lightningd[584548]: Lost connection to the RPC socket.
sep 24 12:44:53 vlad-VirtualBox lightningd[584539]: Lost connection to the RPC socket.
sep 24 12:44:53 vlad-VirtualBox systemd[1]: lightningd.service: Deactivated successfully.
sep 24 12:44:53 vlad-VirtualBox lightningd[584538]: Lost connection to the RPC socket.
sep 24 12:44:53 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 584536 (chanbackup) remains running after unit stopped.
sep 24 12:44:53 vlad-VirtualBox lightningd[584547]: Lost connection to the RPC socket.
sep 24 12:44:53 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 584540 (topology) remains running after unit stopped.
sep 24 12:44:53 vlad-VirtualBox lightningd[584543]: Lost connection to the RPC socket.
sep 24 12:44:53 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 584542 (offers) remains running after unit stopped.
sep 24 12:44:53 vlad-VirtualBox lightningd[584535]: Lost connection to the RPC socket.
sep 24 12:44:53 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 584544 (recklessrpc) remains running after unit stopped.
sep 24 12:44:53 vlad-VirtualBox lightningd[584541]: Lost connection to the RPC socket.
sep 24 12:44:53 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 584545 (recover) remains running after unit stopped.
sep 24 12:44:53 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 584547 (cln-renepay) remains running after unit stopped.
sep 24 12:44:53 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 584552 (bookkeeper) remains running after unit stopped.
sep 24 12:44:53 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 584556 (peerswap) remains running after unit stopped.
sep 24 12:44:53 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 584557 (psweb) remains running after unit stopped.
sep 24 12:44:53 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 584808 (lightning_conne) remains running after unit stopped.
sep 24 12:44:53 vlad-VirtualBox systemd[1]: lightningd.service: Unit process 584928 (lightning_gossi) remains running after unit stopped.
sep 24 12:44:53 vlad-VirtualBox systemd[1]: Stopped Core Lightning daemon.
sep 24 12:44:53 vlad-VirtualBox systemd[1]: lightningd.service: Consumed 29.391s CPU time.
sep 24 12:44:53 vlad-VirtualBox lightningd[584536]: Lost connection to the RPC socket.

@Impa10r
Copy link
Contributor Author

Impa10r commented Sep 24, 2024

@Impa10r Impa10r closed this as completed Sep 24, 2024
@wtogami
Copy link
Contributor

wtogami commented Oct 2, 2024

Why was this closed as completed?

@Impa10r
Copy link
Contributor Author

Impa10r commented Oct 2, 2024

Why was this closed as completed?

Because the bug is on CLN side, so I opened the issue there.

@wtogami
Copy link
Contributor

wtogami commented Oct 2, 2024

Keep it open until the fix is merged upstream

@wtogami wtogami reopened this Oct 2, 2024
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 a pull request may close this issue.

3 participants