Repository navigation
Description
Background
Some channels get disabled but the connections to the channel peers remain active. Network sees that the channel is disabled from one side (my side) but is active from the peer side. They remain this way until I manually disconnect the peer.
Your environment
lnd v0.14.1-beta- Centos 8
4.18.0-305.19.1.el8_4.x86_64 bitcoind 22.0running on a remote node
Steps to reproduce
Unable to reproduce on demand. But it has been happening for the past few weeks over multiple service restarts.
All the channels involved exhibit the same behaviour in the logs:
ChannelLinkfails and exits after attempt to update commit fee- 22 minutes later channel is announced as disabled
- Connection with peer remains active,
GossipSyncerstill works on the peer. - Network sees channel as
disabled:truefrom my side butdisabled:falsefrom the peer side. - This remains until I then manually disconnect the peer, which then causes the new incoming connection to fix everything.
Here are some logs to show the behaviour
Channel 1:
2021-12-16 17:46:16.695 [INF] DISC: GossipSyncer(0272dfe15e1f7781e46fc485249d65af013c092e5a1c474d9ede2a6e7e5624c09c): no more chans to query
2021-12-16 20:04:06.922 [INF] HSWC: ChannelLink(eaddf2d59d74e4f9d9450241772c9180516d6d6a478cb5e23cc48a33e065b33a:1): updating commit fee to 1161 sat/kw sat/kw
2021-12-16 20:25:42.874 [INF] HSWC: ChannelLink(eaddf2d59d74e4f9d9450241772c9180516d6d6a478cb5e23cc48a33e065b33a:1): updating commit fee to 1161 sat/kw sat/kw
2021-12-16 20:26:42.874 [ERR] HSWC: ChannelLink(eaddf2d59d74e4f9d9450241772c9180516d6d6a478cb5e23cc48a33e065b33a:1): failing link: unable to complete dance with error: remote unresponsive
2021-12-16 20:26:42.875 [INF] HSWC: ChannelLink(eaddf2d59d74e4f9d9450241772c9180516d6d6a478cb5e23cc48a33e065b33a:1): exited
2021-12-16 20:26:42.875 [INF] HSWC: ChannelLink(eaddf2d59d74e4f9d9450241772c9180516d6d6a478cb5e23cc48a33e065b33a:1): stopping
2021-12-16 20:47:22.690 [INF] NANN: Announcing channel(eaddf2d59d74e4f9d9450241772c9180516d6d6a478cb5e23cc48a33e065b33a:1) disabled [detected]
2021-12-16 23:44:35.385 [INF] DISC: GossipSyncer(0272dfe15e1f7781e46fc485249d65af013c092e5a1c474d9ede2a6e7e5624c09c): requesting new chans from height=0 and 714409 blocks after
2021-12-17 07:42:24.013 [WRN] CHBU: Replacing disk backup for ChannelPoint(eaddf2d59d74e4f9d9450241772c9180516d6d6a478cb5e23cc48a33e065b33a:1) w/ newer version
2021-12-17 07:48:03.949 [INF] DISC: GossipSyncer(0272dfe15e1f7781e46fc485249d65af013c092e5a1c474d9ede2a6e7e5624c09c): buffering chan range reply of size=8000
2021-12-17 07:48:03.949 [INF] DISC: GossipSyncer(0272dfe15e1f7781e46fc485249d65af013c092e5a1c474d9ede2a6e7e5624c09c): buffering chan range reply of size=8000
2021-12-17 07:48:03.949 [INF] DISC: GossipSyncer(0272dfe15e1f7781e46fc485249d65af013c092e5a1c474d9ede2a6e7e5624c09c): buffering chan range reply of size=7999
2021-12-17 07:48:03.949 [INF] DISC: GossipSyncer(0272dfe15e1f7781e46fc485249d65af013c092e5a1c474d9ede2a6e7e5624c09c): buffering chan range reply of size=8000
2021-12-17 07:48:03.949 [INF] DISC: GossipSyncer(0272dfe15e1f7781e46fc485249d65af013c092e5a1c474d9ede2a6e7e5624c09c): buffering chan range reply of size=7999
2021-12-17 07:48:03.949 [INF] DISC: GossipSyncer(0272dfe15e1f7781e46fc485249d65af013c092e5a1c474d9ede2a6e7e5624c09c): buffering chan range reply of size=7998
2021-12-17 07:48:03.950 [INF] DISC: GossipSyncer(0272dfe15e1f7781e46fc485249d65af013c092e5a1c474d9ede2a6e7e5624c09c): buffering chan range reply of size=8000
2021-12-17 07:48:03.950 [INF] DISC: GossipSyncer(0272dfe15e1f7781e46fc485249d65af013c092e5a1c474d9ede2a6e7e5624c09c): buffering chan range reply of size=7999
2021-12-17 07:48:03.950 [INF] DISC: GossipSyncer(0272dfe15e1f7781e46fc485249d65af013c092e5a1c474d9ede2a6e7e5624c09c): buffering chan range reply of size=8000
2021-12-17 07:48:03.950 [INF] DISC: GossipSyncer(0272dfe15e1f7781e46fc485249d65af013c092e5a1c474d9ede2a6e7e5624c09c): buffering chan range reply of size=7944
2021-12-17 07:48:03.951 [INF] DISC: GossipSyncer(0272dfe15e1f7781e46fc485249d65af013c092e5a1c474d9ede2a6e7e5624c09c): buffering chan range reply of size=2148
2021-12-17 07:48:03.951 [INF] DISC: GossipSyncer(0272dfe15e1f7781e46fc485249d65af013c092e5a1c474d9ede2a6e7e5624c09c): filtering through 82087 chans
2021-12-17 07:48:04.036 [INF] DISC: GossipSyncer(0272dfe15e1f7781e46fc485249d65af013c092e5a1c474d9ede2a6e7e5624c09c): starting query for 23 new chans
2021-12-17 07:48:04.036 [INF] DISC: GossipSyncer(0272dfe15e1f7781e46fc485249d65af013c092e5a1c474d9ede2a6e7e5624c09c): querying for 23 new channels
Channel 2:
2021-12-16 01:43:17.938 [INF] HSWC: ChannelLink(bac1e5b2ef4745e30c0aa16e7a298590674297de17ad7f3addf0668d0a7eff22:1): updating commit fee to 1053 sat/kw sat/kw
2021-12-16 02:16:39.872 [INF] HSWC: ChannelLink(bac1e5b2ef4745e30c0aa16e7a298590674297de17ad7f3addf0668d0a7eff22:1): updating commit fee to 1110 sat/kw sat/kw
2021-12-16 02:17:39.873 [ERR] HSWC: ChannelLink(bac1e5b2ef4745e30c0aa16e7a298590674297de17ad7f3addf0668d0a7eff22:1): failing link: unable to complete dance with error: remote unresponsive
2021-12-16 02:17:39.873 [INF] HSWC: ChannelLink(bac1e5b2ef4745e30c0aa16e7a298590674297de17ad7f3addf0668d0a7eff22:1): exited
2021-12-16 02:17:39.873 [INF] HSWC: ChannelLink(bac1e5b2ef4745e30c0aa16e7a298590674297de17ad7f3addf0668d0a7eff22:1): stopping
2021-12-16 02:38:22.687 [INF] NANN: Announcing channel(bac1e5b2ef4745e30c0aa16e7a298590674297de17ad7f3addf0668d0a7eff22:1) disabled [detected]
2021-12-16 03:09:05.672 [INF] DISC: GossipSyncer(03cb29720b97a67c8b21de36492e45ed28e25b06a04d880b1cbd5fc77c7e0ca782): applying new update horizon: start=2021-12-16 03:09:03 +0800 +08, end=2158-01-22 09:37:18 +0800 +08, backlog_size=0
2021-12-16 03:29:03.971 [INF] DISC: GossipSyncer(03cb29720b97a67c8b21de36492e45ed28e25b06a04d880b1cbd5fc77c7e0ca782): applying new update horizon: start=2042-07-14 09:04:00 +0800 +08, end=2042-07-14 09:04:00 +0800 +08, backlog_size=0
Channel 3 (with manual disconnect at the end):
2021-12-16 05:32:38.204 [INF] HSWC: ChannelLink(bac1e5b2ef4745e30c0aa16e7a298590674297de17ad7f3addf0668d0a7eff22:0): updating commit fee to 1561 sat/kw sat/kw
2021-12-16 05:33:38.204 [ERR] HSWC: ChannelLink(bac1e5b2ef4745e30c0aa16e7a298590674297de17ad7f3addf0668d0a7eff22:0): failing link: unable to complete dance with error: remote unresponsive
2021-12-16 05:33:38.205 [INF] HSWC: ChannelLink(bac1e5b2ef4745e30c0aa16e7a298590674297de17ad7f3addf0668d0a7eff22:0): exited
2021-12-16 05:33:38.206 [INF] HSWC: ChannelLink(bac1e5b2ef4745e30c0aa16e7a298590674297de17ad7f3addf0668d0a7eff22:0): stopping
2021-12-16 05:54:22.686 [INF] NANN: Announcing channel(bac1e5b2ef4745e30c0aa16e7a298590674297de17ad7f3addf0668d0a7eff22:0) disabled [detected]
2021-12-16 07:38:10.008 [INF] DISC: GossipSyncer(03ee951b50d5dc4631bfbde250e7fd2a119a108b7ba3d62079574c584e536563ad): buffering chan range reply of size=7999
2021-12-16 07:38:10.008 [INF] DISC: GossipSyncer(03ee951b50d5dc4631bfbde250e7fd2a119a108b7ba3d62079574c584e536563ad): buffering chan range reply of size=8000
2021-12-16 07:38:10.008 [INF] DISC: GossipSyncer(03ee951b50d5dc4631bfbde250e7fd2a119a108b7ba3d62079574c584e536563ad): buffering chan range reply of size=7999
....
2021-12-17 08:29:28.841 [INF] SRVR: Disconnecting from 03ee951b50d5dc4631bfbde250e7fd2a119a108b7ba3d62079574c584e536563ad@185.220.100.248:19106
2021-12-17 08:29:28.841 [INF] PEER: disconnecting 03ee951b50d5dc4631bfbde250e7fd2a119a108b7ba3d62079574c584e536563ad@185.220.100.248:19106, reason: server: disconnecting peer 03ee951b50d5dc4631bfbde250e7fd2a119a108b7ba3d62079574c584e536563ad@185.220.100.248:19106
2021-12-17 08:29:28.943 [INF] DISC: Removing GossipSyncer for peer=03ee951b50d5dc4631bfbde250e7fd2a119a108b7ba3d62079574c584e536563ad
2021-12-17 08:29:32.337 [INF] SRVR: Finalizing connection to 03ee951b50d5dc4631bfbde250e7fd2a119a108b7ba3d62079574c584e536563ad@209.127.17.234:48042, inbound=true
2021-12-17 08:29:32.573 [INF] PEER: NodeKey(03ee951b50d5dc4631bfbde250e7fd2a119a108b7ba3d62079574c584e536563ad) loading ChannelPoint(bac1e5b2ef4745e30c0aa16e7a298590674297de17ad7f3addf0668d0a7eff22:0)
2021-12-17 08:29:32.574 [INF] HSWC: ChannelLink(bac1e5b2ef4745e30c0aa16e7a298590674297de17ad7f3addf0668d0a7eff22:0): starting
2021-12-17 08:29:32.574 [INF] CNCT: Attempting to update ContractSignals for ChannelPoint(bac1e5b2ef4745e30c0aa16e7a298590674297de17ad7f3addf0668d0a7eff22:0)
2021-12-17 08:29:32.574 [INF] HSWC: ChannelLink(bac1e5b2ef4745e30c0aa16e7a298590674297de17ad7f3addf0668d0a7eff22:0): HTLC manager started, bandwidth=96316000 mSAT
2021-12-17 08:29:32.574 [INF] HSWC: ChannelLink(bac1e5b2ef4745e30c0aa16e7a298590674297de17ad7f3addf0668d0a7eff22:0): attempting to re-synchronize
2021-12-17 08:29:32.574 [INF] PEER: Negotiated chan series queries with 03ee951b50d5dc4631bfbde250e7fd2a119a108b7ba3d62079574c584e536563ad
2021-12-17 08:29:32.575 [INF] DISC: Creating new GossipSyncer for peer=03ee951b50d5dc4631bfbde250e7fd2a119a108b7ba3d62079574c584e536563ad
2021-12-17 08:29:33.539 [INF] HSWC: ChannelLink(bac1e5b2ef4745e30c0aa16e7a298590674297de17ad7f3addf0668d0a7eff22:0): received re-establishment message from remote side
2021-12-17 08:42:53.698 [INF] DISC: GossipSyncer(03ee951b50d5dc4631bfbde250e7fd2a119a108b7ba3d62079574c584e536563ad): applying new update horizon: start=2021-12-17 08:42:53 +0800 +08, end=2158-01-23 15:11:08 +0800 +08, backlog_size=0
2021-12-17 08:48:18.402 [INF] HSWC: ChannelLink(bac1e5b2ef4745e30c0aa16e7a298590674297de17ad7f3addf0668d0a7eff22:0): updating commit fee to 1991 sat/kw sat/kw
2021-12-17 08:48:32.575 [INF] NANN: Announcing channel(bac1e5b2ef4745e30c0aa16e7a298590674297de17ad7f3addf0668d0a7eff22:0) enabled
Expected behaviour
Before disabling a channel, check whether the peer is truly offline and unreachable before finalising the channel disable. Maybe attempt automated disconnect/reconnect to try re-enabling the channel.
Actual behaviour
Channel is announced as disabled, and lnd just waits for a Channel Reestablish message from peer (which never comes because peer has an active connection and thinks channel is still OK).
I will have to manually disconnect the peer to initiate a new fresh connection which enables the channel.
Activity
Roasbeef commentedon Dec 18, 2021
This gets printed out when the remote party doesn't respond to a signature or revocation. So in this case, we disconnect, and then wait for them to connect again, or fall back to our normal exponential back off.
Here is is again with that same peer.
So AFAICT, that peer doesn't respond to us trying to update the channel, we then disconnect to try and cycle things out. Once we connect, they're never stable enough for us to enable again.
hazrulnizam commentedon Dec 18, 2021
Those two messages are with two different peers. They have the same funding txid because I used batch channel opening. If you see carefully the output index is different.
But the disconnect did not happen? Connection with peer is still there, as evidenced by the still functioning
GossipSyncer. If I do alncli listpeersat that point, that peer will be in the list of connected peers. I have to manually disconnect to cycle things out.The reason I am raising this issue is that the disconnect you are saying should happen, does not happen.
hazrulnizam commentedon Dec 21, 2021
Okay, found the culprit. I had the setting
db.batch-commit-intervalset to 5000ms in the config. Once I commented this out, the issue no longer happens (I waited a few days to see).I do not see how it should change any behavior though, seems to me the setting is totally unrelated to how lnd should manage peer unresponsiveness.
rkfg commentedon Jan 5, 2022
I have
db.batch-commit-intervalcommented and I also see this with a couple of peers (lnmarkets.comandBitrefill Routing). Same symptoms:The channel is disabled 22 minutes later:
The peer stays connected but the channel is seen as inactive, oftentimes with pending HTLCs in it. Disconnecting the peer manually causes reconnect and renegotiation, after that the channel works again. But it may stay in this state for hours until I notice which is obviously bad. I realize it's a problem on their end and not mine but I expect lnd to retry connection instead of giving up instantly. It also happens randomly.
Roasbeef commentedon Jan 5, 2022
If this was set to a high value, and you had a lot of incoming gossip traffic, then it would cause goroutines to block at times for 5+ seconds. At that point it's possible the other end hits a deadline w.r.t the write timeout, causing the peer to disconnect.
I think what needs to happen here is that we also tear down the connection, which would effectively cause a reconnect.
We have a few other bug fixes in this area for persistent connections, as well as this comprehensive issue report, which should help narrow things down.
Roasbeef commentedon Jan 19, 2022
Closing this for now as the root issue was discovered, and we have other in flight PRs (as well as merged changes to be released as part of 0.14.2) that target known issues in the p2p code.
rkfg commentedon Feb 12, 2022
Since it still keeps happening here's a temporary script to restore connectivity:
It simply disconnects all peers you have inactive channels with which should trigger a reconnect. Put it to cron so it runs every 10 minutes or so, since channels are disabled after 22 minutes of inactivity by default this should prevent disabling them.
rkfg commentedon Sep 4, 2022
Was this actually fixed? According to my logs it wasn't, the script above prints the message about a recovered node. It only does so if the
disconnectcommand succeeded (returned 0) and it only tries to disconnect peers of inactive channels. If a peer is really offline this commands returns an error and the message isn't printed.Trying 0.15.99-beta (9d04b0c) currently to see if something changed since 0.15.0 where it happened every day multiple times, still I'd be glad for a clarification.
EDIT: investigating further, might be a race condition when the peer connects precisely after the iteration starts.
rkfg commentedon Sep 7, 2022
Yes, still happens, confirmed.
Notice
failing link: unable to complete dance with error: remote unresponsiveand then no disconnect until it was disconnected by the command from the script (reason: server: DisconnectPeer called), after that the peer quickly reconnected and worked fine. Can we reopen this issue since it's still not resolved and it's a very serious issue because without external scripts like mine the peer can stay connected but inactive for indefinite time. The channel becomes unusable because lnd can't reconnect by itself!hazrulnizam commentedon Sep 7, 2022
Yes, I can confirm that this still happens on my node as well. I hope they can re-open this issue as well. Or if not, maybe you can open a new one, and mention that this one was closed without fully resolving it?
rkfg commentedon Sep 14, 2022
@Roasbeef can we reopen this please?
[-]Channel gets disabled but connection with peer is still alive.[/-][+]peer+htlcswitch: unresponsive peer leads to force close[/+]Crypt-iQ commentedon Mar 8, 2023
To summarize the worst case here:
RevokeAndAckand we are trying to send a newCommitSigupdate_fail_htlc/update_fulfill_htlcto resolve a lingering HTLCTheBlueMatt commentedon May 18, 2023
This probably deserves a 16.3 tag or similar, no?