Re: capturing system shutdown signals?
Stas Boukarev <[email protected]>
| Newsgroups | gmane.lisp.steel-bank.general |
|---|---|
| Message-ID | <CAF63=109+ZTY9wwSP=qA0cWHk4KZcLcMbAVygU0E=triNa4heg@mail.gmail.com> |
systemd is able to execute commands in ExecStop=. A named pipe with a thread reading from it is a strategy. With a fallback to handling signals. With a fallback to making code unwind safe (at least the lisp parts, foreign code is another story). On Sat, Apr 27, 2024 at 2:07 AM Stas Boukarev <[email protected]> wrote: > Probably the best bet is disabling signals where things are unwind-safe, > and handling them from a dedicated thread. But there's no API for that. > Barely anything is async unwind safe. > Using sb-posix:pipe + sb-posix:write in an interrupt handler is safe, > provided the function running involves no other lisp code. > > On Sat, Apr 27, 2024 at 1:55 AM Stas Boukarev <[email protected]> wrote: > >> Catching unix signals won't help programs that can't unwind cleanly. >> Unless you just ignore them. >> >> On Sat, Apr 27, 2024 at 1:52 AM Grégory Vanuxem <[email protected]> >> wrote: >> >>> I think the signal-handler stuff in the UNIX package should help you. >>> Install one or more handler(s) I guess: >>> >>> https://github.com/sbcl/sbcl/blob/master/src/code/signal.lisp >>> >>> For Unix-like (POSIX) >>> signals, see: >>> >>> https://sites.uclouvain.be/SystInfo/usr/include/asm-generic/signal.h.html >>> >>> >>> You will first need to handle the SIGTERM, 15 , but eventually 9, hard >>> kill. Eventually more since there are also some other terminaison >>> mechanisms, but I think the SBCL debugger is invoked there, for example >>> floating-point exceptions (division by 0 for example). See man signal(s). >>> >>> https://pubs.opengroup.org/onlinepubs/7908799/xsh/signal.h.html >>> >>> >>> - Greg >>> >>> >>> >>> >>> >>> >>> Le sam. 27 avr. 2024 à 00:31, Stas Boukarev <[email protected]> a >>> écrit : >>> >>>> My "man kill" doesn't contain the word "shutdown" and >>>> kill -L >>>> says >>>> kill: unknown signal: SIGL >>>> >>>> On Sat, Apr 27, 2024 at 1:15 AM Jeff Cunningham < >>>> [email protected]> wrote: >>>> >>>>> See "man kill" or "kill -L" for a list. >>>>> >>>>> >>>>> >>>>> >>>>> On Fri, 26 Apr 2024 23:36:18 +0300 >>>>> Stas Boukarev <[email protected]> wrote: >>>>> >>>>> > What's a shutdown signal? >>>>> > >>>>> > On Fri, Apr 26, 2024 at 8:14 PM Jeff Cunningham < >>>>> [email protected]> >>>>> > wrote: >>>>> > >>>>> > > Is there a way to capture a general shutdown signal in a running >>>>> > > sbcl-compiled program (Hunchentoot >>>>> > > server) so it can gracefully do some house-keeping first? This is >>>>> running >>>>> > > on a Linux platform. I >>>>> > > had a binary data file destroyed the other day from improper >>>>> closure while >>>>> > > writing. >>>>> > > >>>>> > > Best regards, >>>>> > > >>>>> > > -- Jeff >>>>> > > >>>>> > > >>>>> > > >>>>> > > >>>>> > > >>>>> > > >>>>> > > >>>>> > > >>>>> > > _______________________________________________ >>>>> > > Sbcl-help mailing list >>>>> > > [email protected] >>>>> > > https://lists.sourceforge.net/lists/listinfo/sbcl-help >>>>> > > >>>>> >>>>> _______________________________________________ >>>> Sbcl-help mailing list >>>> [email protected] >>>> https://lists.sourceforge.net/lists/listinfo/sbcl-help >>>> >>> _______________________________________________ Sbcl-help mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/sbcl-help