Ignite handles SIGTERM and stops the node.
Use IIgnite.Stopped [1] to shut down the app gracefully.

Example: run this program and use "kill" on it - "Stopped." is printed and
the process exits with code 0.

var ignite = Ignition.Start();
ignite.Stopped += (_, _) =>
{
    Console.WriteLine("Stopped.");
    Environment.Exit(0);
};
Thread.Sleep(-1);


[1]
https://ignite.apache.org/releases/latest/dotnetdoc/api/Apache.Ignite.Core.IIgnite.html#Apache_Ignite_Core_IIgnite_Stopped

On Thu, Sep 7, 2023 at 12:52 AM Raymond Wilson <raymond_wil...@trimble.com>
wrote:

> If you have an Apache Ignite deployment on Kubernetes with Linux
> containers using the DotNet C# Ignite client, how do you trigger
> graceful shutdown of the node?
>
> Kubernetes emits a SIGTERM signal to the pod when it wants to remove it.
> That signal is relayed to the process running in the pod identified in the
> Docker configuration
>
> In our YAML file we start the Ignite node in the pod like this:
>
>         command: ["dotnet"]
>         args: ["SomeNode.dll"]
>
> When it comes time to stop that Ignite node Kubernetes emits the SIGTERM
> to the pod. It appears the 'dotnet' context catches the SIGTERM and it is
> not relayed into the SomeNode.dll logic.
>
> We have several means of catching the SIGTERM configured in our
> application startup logic:
>
>         AppDomain.CurrentDomain.ProcessExit += (s, e) =>  SigTermHandler ;
>         AssemblyLoadContext.Default.Unloading += SigTermHandler;
>         Console.CancelKeyPress += (s, e) =>  SigTermHandler  ;
>
> However the SigTermHandler is never called in our application logic, which
> means the node is then hard killed with a SIGKILL after the termination
> grace period configured for the pod.
>
> If you have a similar tool chain and deployment context, how are you
> ensuring the Ignite node implementation gets the SIGTERM and shuts down
> gracefully?
>
> Thanks,
> Raymond.
>
> --
> <http://www.trimble.com/>
> Raymond Wilson
> Trimble Distinguished Engineer, Civil Construction Software (CCS)
> 11 Birmingham Drive | Christchurch, New Zealand
> raymond_wil...@trimble.com
>
>
> <https://worksos.trimble.com/?utm_source=Trimble&utm_medium=emailsign&utm_campaign=Launch>
>

Reply via email to