IntersectMBO / cardano-launcher

Shelley cardano-node and cardano-wallet launcher for NodeJS applications
https://input-output-hk.github.io/cardano-launcher/
Apache License 2.0
33 stars 9 forks source link

Exit cardano-node when verifying blockchain #132

Open danielmain opened 2 years ago

danielmain commented 2 years ago

Fix that solves the issue when stopping cardano-node at the very beginning when Daedalus starts and it is synchronizing.

Issue When Daedalus is closed cardano-node is not being stopped.

Description Even though Daedalus calls node.stop nothing happens.

Problem in cardano-launcher The switch case ServiceStatus.Started is evaluated The problem is that the if inside the function doStop(timeoutSeconds) is evaluated false (because cfg.shutdownMethod == 2) that is why in the else cardano-node is never stopped.

Solution Adding proc.kill('SIGTERM'); in the else.

rvl commented 2 years ago

Thanks @danielmain - I believe that you have found a cardano-node bug.

Daedalus needs to use ShutdownMethod.CloseFD so that there may be clean node shutdown on Windows, and so that the node receives a shutdown message if ever the Daedalus process crashes or is killed.

The cardano-node logs will probably contain "received shutdown request" which means that the node.stop() function has done its job.

If not, could you please add some logging around the if/else branches in doStop()?

P.S. Here is a doc about why it isn't possible to just send a signal to cardano-node https://github.com/input-output-hk/cardano-launcher/blob/master/docs/windows-clean-shutdown.md

danielmain commented 2 years ago

Reverted kill signal and added logging.