Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.

Conversation

@valentinewallace
Copy link
Contributor

Replaces #564, closes #550.

@ERKarl This consistently works for me to safely shutdown the daemon, is there a reason you wanted to send the signal in the before-quit event?

@cfromknecht
Copy link

@valentinewallace yay minimal diffs 🤓while we're at it, btcd has an analogous shutdown mechanism to lnd. can we also kill btcd with sigint?

@ghost
Copy link

ghost commented Sep 7, 2018

@valentinewallace @cfromknecht
While testing out this branch I'm able to get consistent logs like this:

npm run electron-dev process:

[1] 2018-09-07 14:25:08.340 [INF] BTCD: Gracefully shutting down the database...
[1] 2018-09-07 14:25:08.342 [INF] BTCD: Shutdown complete
[1]
[1] [14:25:08.392] [error] Caught Main Process Error:
[1] [14:25:08.393] [error] Caught Main Process Error:
[1] [14:25:08.393] [error] Caught Main Process Error:
[1] [14:25:08.394] [error] Caught Main Process Error:
[1] [14:25:08.394] [error] Caught Main Process Error:
[1] [14:25:08.394] [info] lnd: 2018-09-07 14:25:08.391 [INF] BTCN: Block manager shutting down
[1]
[1] [14:25:08.400] [error] Caught Main Process Error:
[1] [14:25:08.400] [error] Caught Main Process Error:
[1] wait-on http://localhost:3000 && electron --enable-sandbox . exited with code 0

data/lnd/logs/bitcoin/simnet/lnd.log:

2018-09-07 14:26:32.595 [INF] LTND: Received SIGINT (Ctrl+C).
2018-09-07 14:26:32.595 [INF] LTND: Shutting down...
2018-09-07 14:26:32.595 [INF] LTND: Gracefully shutting down.
2018-09-07 14:26:32.595 [ERR] NTFN: Error during rescan: rescan exited
2018-09-07 14:26:32.595 [INF] CRTR: Channel Router shutting down
2018-09-07 14:26:32.595 [INF] HSWC: Block epoch canceled, decaying hash log shutting down
2018-09-07 14:26:32.595 [INF] CRTR: FilteredChainView stopping
2018-09-07 14:26:32.595 [INF] HSWC: HTLC Switch shutting down
2018-09-07 14:26:32.595 [INF] UTXN: UTXO nursery shutting down
2018-09-07 14:26:32.595 [INF] BRAR: Breach arbiter shutting down
2018-09-07 14:26:32.595 [INF] DISC: Authenticated Gossiper is stopping
2018-09-07 14:26:32.595 [INF] CNCT: Stopping ChainArbitrator
2018-09-07 14:26:32.595 [INF] BTCN: Lost peer 127.0.0.1:18555 (outbound)
2018-09-07 14:26:32.595 [WRN] BTCN: No sync peer candidates available
2018-09-07 14:26:32.595 [INF] FNDG: Funding manager shutting down
2018-09-07 14:26:32.648 [INF] BTCN: Block manager shutting down
2018-09-07 14:26:32.699 [INF] BTCN: Address manager shutting down

Not sure if this is a "clean" shutdown? From the logs I can see that the process gets SIGINT and starts a graceful shutdown, but it doesn't get to [INF] LTND: Shutdown complete analogically to BTCD.

The reason I wanted to use the before-quit event was to prevent the app from actually quitting until btcd & lnd have been gracefully shut down.

@tanx
Copy link
Contributor

tanx commented Sep 7, 2018

@valentinewallace yay minimal diffs 🤓while we're at it, btcd has an analogous shutdown mechanism to lnd. can we also kill btcd with sigint?

Sounds good. Shall we also call .kill('SIGINT') in the integration tests? We kill the btcd node there in between as well.

@valentinewallace
Copy link
Contributor Author

Good tip @cfromknecht, now every daemon shutdown includes a SIGINT :) including integration tests

@tanx tanx merged commit 3443585 into master Sep 10, 2018
@tanx tanx deleted the safe-lnd-shutdown branch September 10, 2018 07:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ensure Safe LND Shutdown on Quit

4 participants