Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connected and disconnected at the same time #3252

Open
ghost opened this issue Nov 10, 2019 · 6 comments
Open

Connected and disconnected at the same time #3252

ghost opened this issue Nov 10, 2019 · 6 comments

Comments

@ghost
Copy link

ghost commented Nov 10, 2019

Issue and Steps to Reproduce

I currently run 2 c-lightning nodes called Bitkoins.nl and Myshtery and they share a channel. I noticed that Myshtery sometimes disconnects from my other node for no reason. Both are running without problems. Just now I get on Myshtery:
"peers": [ { "id": "02888244029c5909593038ab19f269947c720de3423e491791b46c7c92f76279b6", "connected": true,
while on Bitkoins.nl:
"id": "026bc066924bca8a22e4baa751533bf2dda4161544d08dab544a001a5385ab0d0c", "connected": false,

I still think all this trouble started after version 7.2. With version 7.2 I never had any of these problems like #3194 for example.

ALSO: on Bitkoins.nl how can getinfo say
"num_inactive_channels": 0,

while listpeers gives:
{ "id": "026bc066924bca8a22e4baa751533bf2dda4161544d08dab544a001a5385ab0d0c", "connected": false, "channels": [ { "state": "CHANNELD_NORMAL", "scratch_txid": "59d75dfbca3577afb6ff30f4cb53309804725dddb049270229e1aedf6032e6d8", "short_channel_id": "599602x1804x0", "direction": 1, "channel_id": "468bc68dd776b1720c547594c88c76e2912453e04cde620f10d9e5a2db6dae59", "funding_txid": "59ae6ddba2e5d9100f62de4ce0532491e2768cc89475540c72b176d78dc68b46", "private": false, "funding_allocation_msat": { "02888244029c5909593038ab19f269947c720de3423e491791b46c7c92f76279b6": 0, "026bc066924bca8a22e4baa751533bf2dda4161544d08dab544a001a5385ab0d0c": 804742000 }, "funding_msat": { "02888244029c5909593038ab19f269947c720de3423e491791b46c7c92f76279b6": "0msat", "026bc066924bca8a22e4baa751533bf2dda4161544d08dab544a001a5385ab0d0c": "804742000msat" }, "msatoshi_to_us": 417796011, "to_us_msat": "417796011msat", "msatoshi_to_us_min": 0, "min_to_us_msat": "0msat", "msatoshi_to_us_max": 422671011, "max_to_us_msat": "422671011msat", "msatoshi_total": 804742000, "total_msat": "804742000msat", "dust_limit_satoshis": 546, "dust_limit_msat": "546000msat", "max_htlc_value_in_flight_msat": 18446744073709551615, "max_total_htlc_in_msat": "18446744073709551615msat", "their_channel_reserve_satoshis": 8047, "their_reserve_msat": "8047000msat", "our_channel_reserve_satoshis": 8047, "our_reserve_msat": "8047000msat", "spendable_msatoshi": 409749011, "spendable_msat": "409749011msat", "htlc_minimum_msat": 0, "minimum_htlc_in_msat": "0msat", "their_to_self_delay": 144, "our_to_self_delay": 144, "max_accepted_htlcs": 30, "status": [ "CHANNELD_NORMAL:Reconnected, and reestablished." ], "in_payments_offered": 41, "in_msatoshi_offered": 673394733, "in_offered_msat": "673394733msat", "in_payments_fulfilled": 40, "in_msatoshi_fulfilled": 618396011, "in_fulfilled_msat": "618396011msat", "out_payments_offered": 27, "out_msatoshi_offered": 350795553, "out_offered_msat": "350795553msat", "out_payments_fulfilled": 19, "out_msatoshi_fulfilled": 200600000, "out_fulfilled_msat": "200600000msat", "htlcs": [] } ]

But maybe inactive and disconnected mean different things.

After a restart of Myshtery everything turned normal again with both sides giving connected but of course that's not the solution to the problem.

getinfo output

Both are running the same latest software:
Myshtery:
{ "id": "026bc066924bca8a22e4baa751533bf2dda4161544d08dab544a001a5385ab0d0c", "alias": "myshtery", "color": "23375f", "num_peers": 1, "num_pending_channels": 0, "num_active_channels": 1, "num_inactive_channels": 0, "address": [], "binding": [ { "type": "ipv4", "address": "192.168.178.20", "port": 9835 } ], "version": "v0.7.3-31-ga70f2dc", "blockheight": 603122, "network": "bitcoin", "msatoshi_fees_collected": 0, "fees_collected_msat": "0msat", "lightning-dir": "/home/user/.lightning_test" }

Bitkoins.nl:
{ "id": "02888244029c5909593038ab19f269947c720de3423e491791b46c7c92f76279b6", "alias": "Bitkoins.nl", "color": "23354d", "num_peers": 13, "num_pending_channels": 0, "num_active_channels": 11, "num_inactive_channels": 0, "address": [ { "type": "ipv4", "address": "82.217.214.215", "port": 9735 }, { "type": "torv2", "address": "tjeuwxa2rr24iprs.onion", "port": 9735 }, { "type": "torv3", "address": "2bh7psr4dinasuz3d6jm5o56ebkmlnotqqptoesikzvsyqxwmaneyiad.onion", "port": 9735 } ], "binding": [ { "type": "ipv4", "address": "192.168.178.20", "port": 9735 } ], "version": "v0.7.3-31-ga70f2dc", "blockheight": 603117, "network": "bitcoin", "msatoshi_fees_collected": 144441, "fees_collected_msat": "144441msat", "lightning-dir": "/home/user/.lightning" }

@ghost
Copy link
Author

ghost commented Nov 15, 2019

Closing this issue as I got the feeling this issue has been solved since #3194 has been solved. Node Estonia was often disconnected and then connected again which seems related to the what was reported here.I don't see that anymore since I updated to version v0.7.3-88-gf075b87. Will reopen if it occurs again.

@ghost ghost closed this as completed Nov 15, 2019
@ghost ghost reopened this Dec 15, 2019
@ghost
Copy link
Author

ghost commented Dec 15, 2019

Reopening this because it's still an issue.

@ghost
Copy link
Author

ghost commented Jan 4, 2020

Happened again today:

"id": "02aecde3b3dde450889755d4dbce538e6b9e9dfa7702d14b5bc5c4379e1b330392",
says:
"id": "02888244029c5909593038ab19f269947c720de3423e491791b46c7c92f76279b6",
"connected": true,

"id": "02888244029c5909593038ab19f269947c720de3423e491791b46c7c92f76279b6",
says
"id": "02aecde3b3dde450889755d4dbce538e6b9e9dfa7702d14b5bc5c4379e1b330392",
"connected": false,

Both run: v0.8.0-1-gb14b2b0

@cdecker
Copy link
Member

cdecker commented Feb 3, 2020

This can happen sometimes if the connection was interrupted and no messages have been sent for a while (TCP timeout). You can try pinging the other side of the channel and see if it responds:

Run the following on 02888244029c5909593038ab19f269947c720de3423e491791b46c7c92f76279b6

lightning-cli ping 02aecde3b3dde450889755d4dbce538e6b9e9dfa7702d14b5bc5c4379e1b330392

and/or this on 02aecde3b3dde450889755d4dbce538e6b9e9dfa7702d14b5bc5c4379e1b330392

lightning-cli ping 02888244029c5909593038ab19f269947c720de3423e491791b46c7c92f76279b6

@ghost
Copy link
Author

ghost commented Feb 3, 2020

Thanks again! I will do so the next time it happens again but why don't they disconnect both at around the same time (so after a while)?

@ZmnSCPxj
Copy link
Contributor

ZmnSCPxj commented Feb 4, 2020

Because TCP is actually a hack on top of IP, the connection is provided by the TCP layer and the two TCP layers on the two computers are not necessarily 100% in sync at all times.

See, IP is just a datagram protocol with resilient but NOT reliable sending. So TCP sends out data and then ACKs back. So for example if Alice TCP layer sends out a datagram to Bob TCP layer, Bob starts a timer then (last time it saw Alice datagram). Then Bob sends back an ACK to Alice TCP. When Alice TCP receives it, it starts a timer (last time it saw Bob datagram). Then the Internet breaks between them, but they cannot see this immediately (because IP is a datagram protocol, so most of the time what they will see is nothing because there is no message ongoing, so they cannot detect Internet breakage). Then Bob timer times out faster and it thinks it has disconnected but Alice (whose timer was started later) thinks it is still connected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants