Commit Graph

12 Commits

Author SHA1 Message Date
Rafe
62dc1b5323 multi: Update Licenses to 2022 [skip ci] 2022-02-09 00:25:20 +02:00
Martin Habovstiak
17cf90ee34 signal: clarify the log message about systemd
The log message was confusing because it was emitted even when running
within systemd if the service type was **not** `notify`. This clarifies
the message by mentioning the edge case.

Being able to distinguish the two cases would be nicer but there doesn't
seem to be a reasonably simple, obvious, reliable way to do it.
Complicated solutions are most likely not worth it for a simple log
message.
2021-12-16 14:02:24 +01:00
Martin Habovstiak
4bcb32753f lnd+signal: implement systemd notify
This adds support for notifying systemd about the state of LND. It
notifies systemd just before waiting for wallet password or, if
`wallet-password-file` was specified, right after unlocking the wallet.

This means that "ready" represents RPC being available for intended use.
It's intentional, so that client services can use `After=` in `systemd`
configuration to avoid misleading error messages about missing files or
refused connections.

Part of #4470
2021-08-20 13:26:48 +02:00
Hampus Sjöberg
ada1bc701c signal: handle shutdown properly
This addresses issues related to the mobile lnd builds, where
calling `stopDaemon` and subsequently calling LndMobile's `Start`
results in crash.
2021-03-18 12:54:25 +01:00
Matheus Degiovani
38c74f6418
signal: do not trap SIGABRT
SIGABRT is used by the Go runtime to forcefully terminate all
goroutines, even if they are in a deadlocked state.

It is useful in development (to get a glimpse of any potential race or
hang conditions) and in production to forcefully terminate execution
when a standard SIGQUIT won't do.

This modifies the signal package to _not_ trap SIGABRT and let it be
handled in the standard way by the runtime.
2020-09-17 12:27:40 -03:00
carla
daae8a9944
multi: wrap logger to request shutdown from signal on critical error
This commit adds a shutdown logger which will send a request for
shutdown on critical errors. It uses the signal package to request safe
shutdown of the daemon. Since we init our logs in config validation,
we add a started channel to the signal package to prevent the case where
we have a critical log after the ShutdownLogger has started but before
the daemon has started listening for intercepts. In this case, we just
ignore the shutdown request.
2020-08-24 08:54:34 +02:00
Joost Jager
6c6bbdd365
signal: initialize interceptor explictly 2019-11-12 19:16:22 +01:00
Olaoluwa Osuntokun
0ca65208c5
signal: don't attempt to catch SIGSTOP
In this commit, we modify the set of default signals we attempt to catch in
order to execute a graceful shutdown. Before this commit, we would attempt
to catch/register for `SIGSTOP`. There're two issues with this

  1. `SIGSTOP` is meant to be used in combination with `SIGCONCT` to allow a
  process to be paused/resumed. Therefore, our action of shutting down once
  received was incorrect.

  2. `SIGSTOP` doesn't exist on windows, so users aren't able to compile on
  this platform without modifying the codebase.
2019-04-03 13:13:03 -07:00
Olaoluwa Osuntokun
c731a99647
signal: catch all termination signals by default
In this commit, we modify the primary `signal` package to instead catch
all signals. Before this commit, it would only catch the interrupt
signal sent from the kernel. With this new commit, we'll now also catch
(or attempt to catch): `SIGABRT`, `SIGTERM`, `SIGSTOP`, and `SIGQUIT`.
2019-03-27 12:56:45 -07:00
Conner Fromknecht
59b459674d
multi: init subsystem loggers via build pkg 2018-10-05 13:04:45 +09:00
Conner Fromknecht
3aa8f7a6b9
signal/log: adds signal logger 2018-06-28 16:17:01 -07:00
Conner Fromknecht
0ae6dec4f3
signal/signal: creates package for monitoring of OS signals 2018-06-28 16:16:58 -07:00