lnd: Can't clean shutdown lnd with --watchtower.active
Background
I run lnd
with --watchtower.active
, but I can’t clean shutdown lnd
.
Your environment
- lnd v0.11.0-beta.rc1
- Ubuntu 18.04.2 LTS
- btcd 0.20.1-beta
Steps to reproduce
lnd --watchtower.active
and then shut down the lnd
Expected behaviour
Normal exit and the output is LTND: Shutdown complete
Actual behaviour
It is hanging and can’t be shut down, the output is
2020-09-02 11:01:00.714 [INF] LTND: Received interrupt
2020-09-02 11:01:00.715 [INF] LTND: Shutting down...
2020-09-02 11:01:00.715 [INF] LTND: Gracefully shutting down.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 17 (5 by maintainers)
I was finally able to reproduce it! The problem occurs if there is no active session and the number of updates is exhausted:
If that happens, the
sessionQueue
is set to nil here: https://github.com/lightningnetwork/lnd/blob/master/watchtower/wtclient/client.go#L848 That causes the main loop to not read from the pipeline anymore, this isn’t reached: https://github.com/lightningnetwork/lnd/blob/master/watchtower/wtclient/client.go#L772Therefore on shutdown, the task pipeline’s
signalUntilShutdown()
has no effect as nobody’s listening on https://github.com/lightningnetwork/lnd/blob/master/watchtower/wtclient/task_pipeline.go#L164.I’m really not sure what to do in this situation, this code base is very unfamiliar to me. @cfromknecht could you take a look please?
@jogc you can solve this problem manually by removing all faulty sessions the way @wpaulino mentioned in the previous comment. The shutdown hang is caused by too many non-submitted backups. Once that queue is cleared, the problem should be gone. But we obviously still want to fix the issue itself.
The goroutine profile shows that
lnd
is still in the process of starting up, specifically trying to connect tobtcd
for fee estimation. There’s no trace of a shutdown request at all.