-
Notifications
You must be signed in to change notification settings - Fork 721
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
Cross-platform clean shutdown #726
Comments
Correct. But why are you killing with |
Windows -- check the linked doc. |
I see. Windows 🙄 |
@rvl can you try https://docs.microsoft.com/en-us/windows/console/generateconsolectrlevent This is the closest I can find to a standard method on Windows. It only works for console applications, but the node and wallet are console so that's ok. I know that the wallet takes the approach of terminating when stdin is closed, but this isn't standard behaviour on Windows except for console applications that actually use stdin. It is also not something you want to do uniformly on other platforms: process monitors like systemd will by default connect their stdin to |
@dcoutts Thanks for investigating.
|
|
|
Yes. The FD in the child process of the pipe you create for the purpose. Normal Unix FD / Win32 HANDLE inheritance mechanism. |
Fixes #726 On Windows there is no standard reliable mechanism to politely ask a process to stop. There is only the brutal TerminateProcess. Using that by default is not great since it means the node always has to revalidate its chain DB on startup. This adds an ad-hoc mechainsim that Daedalus can use to reliably shut down the node process. The --shutdown-ipc flag takes the FD of the read ebd of an inherited pipe. If provided, the node will monitor that pipe when when the write end of the pipe is closed then the node will initiate a clean shutdown. So Daedalus can explicitly terminate the node by closing the write end of the pipe. If Daedalus terminates uncleanly then the pipe will also be closed and the node will also shut down. Although this mechanism is needed for Windows, it is also cross-platform so it can be used by Daedalus across all platforms.
Fixes #726 On Windows there is no standard reliable mechanism to politely ask a process to stop. There is only the brutal TerminateProcess. Using that by default is not great since it means the node always has to revalidate its chain DB on startup. This adds an ad-hoc mechainsim that Daedalus can use to reliably shut down the node process. The --shutdown-ipc flag takes the FD of the read ebd of an inherited pipe. If provided, the node will monitor that pipe when when the write end of the pipe is closed then the node will initiate a clean shutdown. So Daedalus can explicitly terminate the node by closing the write end of the pipe. If Daedalus terminates uncleanly then the pipe will also be closed and the node will also shut down. Although this mechanism is needed for Windows, it is also cross-platform so it can be used by Daedalus across all platforms.
767: Cross-platform clean shutdown mechanism r=dcoutts a=dcoutts Cross-platform clean shutdown support with `--shutdown-ipc FD` flag Fixes #726 On Windows there is no standard reliable mechanism to politely ask a process to stop. There is only the brutal TerminateProcess. Using that by default is not great since it means the node always has to revalidate its chain DB on startup. This adds an ad-hoc mechainsim that Daedalus can use to reliably shut down the node process. The `--shutdown-ipc` flag takes the FD of the read end of an inherited pipe. If provided, the node will monitor that pipe when when the write end of the pipe is closed then the node will initiate a clean shutdown. So Daedalus can explicitly terminate the node by closing the write end of the pipe. If Daedalus terminates uncleanly then the pipe will also be closed and the node will also shut down. Although this mechanism is needed for Windows, it is also cross-platform so it can be used by Daedalus across all platforms. Co-authored-by: Duncan Coutts <[email protected]> Co-authored-by: Kosyrev Serge <[email protected]>
Provide a method which cardano-launcher can use to politely request that
cardano-node
exits.If
cardano-node
is killed impolitely (with SIGKILL on POSIX or TerminateProcess on Windows), it will do a complete revalidation of the chain on the next startup. This can take some minutes.See cardano-launcher/docs/windows-clean-shutdown.md for a discussion of the issue and suggested solution.
This is the implementation in cardano-wallet - withShutdownHandler. This code is enabled when the
--shutdown-handler
switch is provided to thecardano-wallet
CLI.The text was updated successfully, but these errors were encountered: