Description
litd stops with a "successful" exit code 0 when it stops upon lnd exiting due to a failure and a non-0 exit status code.
Expected behavior
litd to exit with a non-0 exit code since it's stopping unexpectedly (and lnd presumably stopped unexpectedly as well).
Actual behavior
litd exits with a 0 exit code.
To reproduce
Have litd and lnd running - I have them running in systemd. Shutting down bitcoind causes lnd to exit with a failure status code while litd exits with a 0 code.
System information
I'm using litd binaries downloaded from github with a separate standalone lnd instance. This is on a rpi4 arm64.
Below are systemd status logs from lnd and litd (with some extra log output for litd) that shows lnd having exited with 1/FAILURE
while litd exits with 0/SUCCESS
.
$ sudo systemctl status lnd
● lnd.service - LND Lightning Daemon
Loaded: loaded (/etc/systemd/system/lnd.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Mon 2021-12-06 10:07:32 EST; 55s ago
Process: 21935 ExecStart=/home/bitcoin/go/bin/lnd (code=exited, status=1/FAILURE)
Main PID: 21935 (code=exited, status=1/FAILURE)
$ sudo systemctl status lit
● lit.service - LND Lightning Terminal
Loaded: loaded (/etc/systemd/system/lit.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Mon 2021-12-06 10:06:51 EST; 3min 24s ago
Process: 15969 ExecStart=/home/bitcoin/lit/litd (code=exited, status=0/SUCCESS)
Main PID: 15969 (code=exited, status=0/SUCCESS)
2021-12-06 10:06:48.679 [INF] SGNL: Received terminated
2021-12-06 10:06:48.820 [INF] SGNL: Shutting down...
2021-12-06 10:06:48.856 [INF] SGNL: Gracefully shutting down.
2021-12-06 10:06:48.857 [INF] LITD: Shutdown signal received
2021-12-06 10:06:48.883 [INF] LOOPD: Stopping gRPC server
2021-12-06 10:06:48.883 [INF] LOOPD: Stopping REST server
2021-12-06 10:06:48.883 [INF] LOOPD: Liquidity manager stopped
2021-12-06 10:06:48.885 [INF] LOOP: Swap client terminating
2021-12-06 10:06:48.885 [INF] LOOP: Swap client terminated
2021-12-06 10:06:48.885 [INF] LOOPD: Swap client stopped
2021-12-06 10:06:48.927 [ERR] ACCT: Unable to receive block notification: rpc error: code = Unavailable desc = error reading from server: read tcp 127.0.0.1:39338->127.0.0.1:10009: use of closed network connection
2021-12-06 10:06:48.884 [ERR] RPCS: Unable to receive block notification: rpc error: code = Unavailable desc = error reading from server: read tcp 127.0.0.1:39338->127.0.0.1:10009: use of closed network connection
2021-12-06 10:06:48.979 [ERR] RPCS: Unable to receive block notification: channel acceptor receive failed: rpc error: code = Unavailable desc = error reading from server: read tcp 127.0.0.1:39338->127.0.0.1:10009: use of closed network connection
2021-12-06 10:06:48.979 [INF] LOOPD: Daemon exited
2021-12-06 10:06:48.979 [INF] POOL: Received shutdown signal, stopping server
2021-12-06 10:06:48.979 [INF] AUCT: Shutting down auctioneer client
2021-12-06 10:06:48.979 [INF] RPCS: Trader server stopping
Dec 06 10:06:48 satoshpi litd[15969]: 2021-12-06 10:06:48.979 [INF] AUCT: Shutting down auctioneer client
Dec 06 10:06:48 satoshpi litd[15969]: 2021-12-06 10:06:48.980 [INF] FNDG: Funding manager stopping
Dec 06 10:06:48 satoshpi litd[15969]: 2021-12-06 10:06:48.980 [INF] FNDG: Stopped funding manager
Dec 06 10:06:48 satoshpi litd[15969]: 2021-12-06 10:06:48.981 [INF] RPCS: Stopped trader server
Dec 06 10:06:48 satoshpi litd[15969]: 2021-12-06 10:06:48.981 [ERR] LNDC: Error closing lnd connection: rpc error: code = Canceled desc = grpc: the client connection is closing
Dec 06 10:06:51 satoshpi litd[15969]: 2021-12-06 10:06:51.067 [ERR] LNDC: Error closing lnd connection: rpc error: code = Canceled desc = grpc: the client connection is closing
Dec 06 10:06:51 satoshpi systemd[1]: lit.service: Succeeded.
Dec 06 10:06:51 satoshpi systemd[1]: Stopped LND Lightning Terminal.
Dec 06 10:07:32 satoshpi systemd[1]: Dependency failed for LND Lightning Terminal.
Dec 06 10:07:32 satoshpi systemd[1]: lit.service: Job lit.service/start failed with result 'dependency'.