aurae-runtime / aurae

Distributed systems runtime daemon written in Rust.
https://aurae.io
Apache License 2.0
1.85k stars 91 forks source link

POSIX Signal Handler and Proxy/Bus #199

Open krisnova opened 1 year ago

krisnova commented 1 year ago

Now that auraed is launching nested versions of itself, we will need to proxy POSIX signals through auraed

  1. Implement a POSIX compliant signal handler in Rust in Auraed and provide documentation on which signals map to what behavior.

SIGKILL should terminate (kill) the process SIGHUP should reload the config from disk and reopen logfiles SIGINT should "interrupt" the process and begin to "die nice" ensuring any cleanup logic can be done

  1. Use SIGINT instead of SIGKILL to "free" a nested auraed after the signal handler has been implemented.

  2. Proxy all signals to nested executables for them to manage independently.

For example sending a SIGHUP to a nested auraed should proxy a SIGHUP to all of the nested executables!

dmah42 commented 1 year ago

i believe SIGTERM should do the "die nice". SIGINT is a "user triggered interrupt" signal that processes can interpret however they want but it doesn't necessarily suggest termination.

https://dsa.cs.tsinghua.edu.cn/oj/static/unix_signal.html

this also suggests "SIGINT is nearly identical to SIGTERM". SIGINT is explicity "sent from a user" though.

future-highway commented 1 year ago

Looking for some clarification on 3...

Should (a) every signal auraed receives be sent to every executable? Or are we saying (b) we want to add rpc signal(CellServiceSignalRequest) ... so that clients can send targeted signals to select executables?

I'm thinking we want the option b. Right?

dmah42 commented 3 months ago

if a SIGKILL is sent to auraed, i assume it means "die in a fire" and we should take down everything auraed has spawned along with us.

SIGTERM would be the same, and would also expect spawned processes/nested aurae to "die nicely" so that needs to be passed along, but maybe that means calling the various Stop and Free APIs instead.

SIGHUP is a different one as i suspect we'd only want that to be handled by auraed.

so i think 1 and 2 hold, but 3 isn't necessary as it's not obvious how we would interpret the signals.

this leaves an open question: how do we send a signal to a spawned executable managed by a nested auraed?