Skip to content

Connection to the peer quietly dropped immediately after lncli connect #6097

Closed

Description

@xmrk-btc

Background

A peer gets disconnected, I try lncli connect and it appears successful:

$ ~/go/bin/lncli connect 033fc44ec70c1c5a269a7d7c1cfdaf6f9ec7a92bbe7a8e1473e3663ce7ce8d399b@136.25.131.81:9735
{

}

but in reality the connection is made but dropped almost immediately.

# tcpdump  -i ppp0 -n ip host 136.25.131.81
21:24:24.541178 IP 86.127.232.2.52506 > 136.25.131.81.9735: Flags [S], seq 1270341680, win 65340, options [mss 1452,sackOK,TS val 3685165113 ecr 0,nop,wscale 7], length 0
21:24:24.707010 IP 136.25.131.81.9735 > 86.127.232.2.52506: Flags [S.], seq 3010305427, ack 1270341681, win 65160, options [mss 1460,sackOK,TS val 1728863948 ecr 3685165113,nop,wscale 7], length 0
21:24:24.707193 IP 86.127.232.2.52506 > 136.25.131.81.9735: Flags [.], ack 1, win 511, options [nop,nop,TS val 3685165279 ecr 1728863948], length 0
21:24:24.710047 IP 86.127.232.2.52506 > 136.25.131.81.9735: Flags [P.], seq 1:51, ack 1, win 511, options [nop,nop,TS val 3685165282 ecr 1728863948], length 50
21:24:24.874790 IP 136.25.131.81.9735 > 86.127.232.2.52506: Flags [.], ack 51, win 509, options [nop,nop,TS val 1728864116 ecr 3685165282], length 0
21:24:24.902351 IP 136.25.131.81.9735 > 86.127.232.2.52506: Flags [P.], seq 1:51, ack 51, win 509, options [nop,nop,TS val 1728864144 ecr 3685165282], length 50
21:24:24.902496 IP 86.127.232.2.52506 > 136.25.131.81.9735: Flags [.], ack 51, win 511, options [nop,nop,TS val 3685165474 ecr 1728864144], length 0
21:24:25.064333 IP 86.127.232.2.52506 > 136.25.131.81.9735: Flags [P.], seq 51:117, ack 51, win 511, options [nop,nop,TS val 3685165636 ecr 1728864144], length 66
21:24:25.064871 IP 86.127.232.2.52506 > 136.25.131.81.9735: Flags [F.], seq 117, ack 51, win 511, options [nop,nop,TS val 3685165637 ecr 1728864144], length 0
21:24:25.229012 IP 136.25.131.81.9735 > 86.127.232.2.52506: Flags [.], ack 117, win 509, options [nop,nop,TS val 1728864471 ecr 3685165636], length 0
21:24:25.231256 IP 136.25.131.81.9735 > 86.127.232.2.52506: Flags [P.], seq 51:69, ack 118, win 509, options [nop,nop,TS val 1728864473 ecr 3685165637], length 18
21:24:25.231369 IP 86.127.232.2.52506 > 136.25.131.81.9735: Flags [R], seq 1270341798, win 0, length 0
21:24:25.231439 IP 136.25.131.81.9735 > 86.127.232.2.52506: Flags [P.], seq 69:346, ack 118, win 509, options [nop,nop,TS val 1728864473 ecr 3685165637], length 277
21:24:25.231517 IP 86.127.232.2.52506 > 136.25.131.81.9735: Flags [R], seq 1270341798, win 0, length 0
21:24:25.231562 IP 136.25.131.81.9735 > 86.127.232.2.52506: Flags [F.], seq 346, ack 118, win 509, options [nop,nop,TS val 1728864473 ecr 3685165637], length 0
21:24:25.231615 IP 86.127.232.2.52506 > 136.25.131.81.9735: Flags [R], seq 1270341798, win 0, length 0

Strangely, my node is the one closing the connection.

Nothing related to this peer is logged on level INFO, I tried logging everything on TRACE, and got only this:

$ ~/go/bin/lncli debuglevel --level trace; ~/go/bin/lncli connect 033fc44ec70c1c5a269a7d7c1cfdaf6f9ec7a92bbe7a8e1473e3663ce7ce8d399b@136.25.131.81:9735; ~/go/bin/lncli debuglevel --level info
$ grep "\(033fc44\)\|\(2711f807b93ee6cf4cc01ed0cc6866b54949c1ea748e4a721709eddaee870da7:2\)\|\(708020.847.1\)" ~/.lnd/logs/bitcoin/mainnet/lnd.log
2021-12-16 18:53:33.582 [INF] NTFN: New spend subscription: spend_id=120, outpoint=2711f807b93ee6cf4cc01ed0cc6866b54949c1ea748e4a721709eddaee870da7:2, script=0 6dc61da06963683c065a5236aa42c017655e481c33ac81049dbac1ca7159ea81, height_hint=714419
2021-12-16 18:53:33.582 [INF] NTFN: Dispatching historical spend rescan for outpoint=2711f807b93ee6cf4cc01ed0cc6866b54949c1ea748e4a721709eddaee870da7:2, script=0 6dc61da06963683c065a5236aa42c017655e481c33ac81049dbac1ca7159ea81, start=714419, end=714422
2021-12-16 18:53:38.661 [INF] CNCT: Close observer for ChannelPoint(2711f807b93ee6cf4cc01ed0cc6866b54949c1ea748e4a721709eddaee870da7:2) active
2021-12-16 18:53:47.701 [INF] CNCT: ChannelArbitrator(2711f807b93ee6cf4cc01ed0cc6866b54949c1ea748e4a721709eddaee870da7:2): starting state=StateDefault, trigger=chainTrigger, triggerHeight=714422
2021-12-16 18:53:59.399 [WRN] CHBU: Replacing disk backup for ChannelPoint(2711f807b93ee6cf4cc01ed0cc6866b54949c1ea748e4a721709eddaee870da7:2) w/ newer version
2021-12-16 18:56:05.121 [INF] SRVR: Finalizing connection to 033fc44ec70c1c5a269a7d7c1cfdaf6f9ec7a92bbe7a8e1473e3663ce7ce8d399b@136.25.131.81:58714, inbound=true
2021-12-16 18:56:05.135 [INF] PEER: NodeKey(033fc44ec70c1c5a269a7d7c1cfdaf6f9ec7a92bbe7a8e1473e3663ce7ce8d399b) loading ChannelPoint(2711f807b93ee6cf4cc01ed0cc6866b54949c1ea748e4a721709eddaee870da7:2)
2021-12-16 18:56:05.137 [INF] HSWC: ChannelLink(2711f807b93ee6cf4cc01ed0cc6866b54949c1ea748e4a721709eddaee870da7:2): starting
2021-12-16 18:56:05.138 [INF] PEER: Negotiated chan series queries with 033fc44ec70c1c5a269a7d7c1cfdaf6f9ec7a92bbe7a8e1473e3663ce7ce8d399b
2021-12-16 18:56:05.139 [INF] DISC: Creating new GossipSyncer for peer=033fc44ec70c1c5a269a7d7c1cfdaf6f9ec7a92bbe7a8e1473e3663ce7ce8d399b
2021-12-16 18:56:05.138 [INF] CNCT: Attempting to update ContractSignals for ChannelPoint(2711f807b93ee6cf4cc01ed0cc6866b54949c1ea748e4a721709eddaee870da7:2)
2021-12-16 18:56:05.138 [INF] HSWC: ChannelLink(2711f807b93ee6cf4cc01ed0cc6866b54949c1ea748e4a721709eddaee870da7:2): HTLC manager started, bandwidth=2408269700 mSAT
2021-12-16 18:56:05.139 [INF] HSWC: ChannelLink(2711f807b93ee6cf4cc01ed0cc6866b54949c1ea748e4a721709eddaee870da7:2): attempting to re-synchronize
2021-12-16 18:56:05.284 [INF] HSWC: ChannelLink(2711f807b93ee6cf4cc01ed0cc6866b54949c1ea748e4a721709eddaee870da7:2): received re-establishment message from remote side
2021-12-16 19:47:11.718 [INF] DISC: GossipSyncer(033fc44ec70c1c5a269a7d7c1cfdaf6f9ec7a92bbe7a8e1473e3663ce7ce8d399b): applying new update horizon: start=2021-12-16 19:47:11 +0000 UTC, end=2158-01-23 02:15:26 +0000 UTC, backlog_size=0
2021-12-16 20:03:20.303 [INF] PEER: disconnecting 033fc44ec70c1c5a269a7d7c1cfdaf6f9ec7a92bbe7a8e1473e3663ce7ce8d399b@136.25.131.81:58714, reason: server: disconnecting peer 033fc44ec70c1c5a269a7d7c1cfdaf6f9ec7a92bbe7a8e1473e3663ce7ce8d399b@136.25.131.81:58714
2021-12-16 20:03:20.303 [INF] PEER: unable to read message from 033fc44ec70c1c5a269a7d7c1cfdaf6f9ec7a92bbe7a8e1473e3663ce7ce8d399b@136.25.131.81:58714: read tcp 86.127.232.2:9735->136.25.131.81:58714: use of closed network connection
2021-12-16 20:08:20.884 [INF] HSWC: ChannelLink(2711f807b93ee6cf4cc01ed0cc6866b54949c1ea748e4a721709eddaee870da7:2): updating commit fee to 1274 sat/kw sat/kw
2021-12-16 20:25:23.429 [INF] HSWC: ChannelLink(2711f807b93ee6cf4cc01ed0cc6866b54949c1ea748e4a721709eddaee870da7:2): updating commit fee to 1274 sat/kw sat/kw
2021-12-16 20:26:23.435 [ERR] HSWC: ChannelLink(2711f807b93ee6cf4cc01ed0cc6866b54949c1ea748e4a721709eddaee870da7:2): failing link: unable to complete dance with error: remote unresponsive
2021-12-16 20:26:23.435 [INF] HSWC: ChannelLink(2711f807b93ee6cf4cc01ed0cc6866b54949c1ea748e4a721709eddaee870da7:2): exited

2021-12-16 21:22:35.127 [ERR] RPCS: [/lnrpc.Lightning/DisconnectPeer]: unable to disconnect peer: peer 033fc44ec70c1c5a269a7d7c1cfdaf6f9ec7a92bbe7a8e1473e3663ce7ce8d399b is not connected

2021-12-16 21:24:24.540 [DBG] RPCS: [connectpeer] requested connection to 033fc44ec70c1c5a269a7d7c1cfdaf6f9ec7a92bbe7a8e1473e3663ce7ce8d399b@136.25.131.81:9735
2021-12-16 21:24:24.540 [DBG] SRVR: Connecting to 033fc44ec70c1c5a269a7d7c1cfdaf6f9ec7a92bbe7a8e1473e3663ce7ce8d399b@136.25.131.81:9735
2021-12-16 21:24:25.065 [DBG] RPCS: Connected to peer: 033fc44ec70c1c5a269a7d7c1cfdaf6f9ec7a92bbe7a8e1473e3663ce7ce8d399b@136.25.131.81:9735
9735

And all of this seems to be solved by simply restarting lnd, so the problem should be on my side.

Additionally, it seems to be related to inbound connections, I connected to that node (so outbound from my POV) today at least 4 times before, only the last connection in inbound, it got disconnected and then no reconnection from my side is possible. Also before, when my node was behind NAT, I tried disconnecting outbound connections, so peers would connect to me. (I thought NAT was the problem, something like limited capacity of router's NAT table, so inbound connections should cause less problems. Those were clearnet connections, I had port forwarding configured on my router, so peers could connect to me by IPv4.) And this caused random peers being disconnected, e.g. I have an outbound connection to peer A, I disconnect from peer A , peer A reconnects, and unrelated peer B gets disconnected a minute later. The same things seems to happen now, without NAT.

Different from #4941, because the connection is dropped sooner. And it should not be caused by outdated software of the peer, incidentally I got c-otto's node in this unconnectable state, and he commented he runs lnd 0.14.x .

Your environment

  • version of lnd: 0.14.1
  • which operating system (uname -a on *Nix): Linux ubuntu 5.11.0-1023-raspi #25-Ubuntu SMP PREEMPT Fri Nov 19 07:45:23 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux
  • version of btcd, bitcoind, or other backend: bitcoind 0.22, not pruned
  • my node has public IPv4 address now, so no NAT in the way, but the same thing happened with the node behind NAT
  • tor.skip-proxy-for-clearnet-targets=1
  • tor.streamisolation not set (defaults to 0 I guess)

Activity

  1. xmrk-btc commented on Dec 19, 2021

    @xmrk-btc
    Author

    Some additional observations:
    I can connect successfully to a node with which I have no channel, even after this problem occurs. That is, I connect manually (lncli connect) to a node A, and the connection is dropped, no INFO logs etc, as described above. But then I connect to some node B, with which I have no channel, and the connection is established, it does generate the typical Finalizing connection log lines. Thus this should not be a problem of the network nor configuration of my node (like some kernel networking limit) .

    I am running lnd with ulimit -n 4000.

    I tried switching tor to client-only (before, I was running tor as relay also), and still reproduced the problem.

    lncli getinfo reports wrong number:

    $ ~/go/bin/lncli getinfo|grep num_inactive
        "num_inactive_channels": 12,
    $ ~/go/bin/lncli listchannels| grep '"active": false' | wc -l
    31
    

    I would expect the two commands to give the same number.

    channel.db size is a bit below 5 GB.

    And note that this is happening all the time, I restart lnd and 6-12 hours later my inactive channel count grows by 10-30 , and after restarting lnd, those 10-30 channels are active.

  2. Crypt-iQ commented on Aug 15, 2022

    @Crypt-iQ
    Collaborator

    Need more logs here without filtering via grep. This is probably something to do with how the server handles connection replacement

  3. saubyk commented on Nov 28, 2023

    @saubyk
    Collaborator

    Closing due to inactivity and missing reproduction. Feel free to reopen if the issue persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions