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

Reconnect only for outgoing peers #739

Closed
offerm opened this issue Dec 6, 2018 · 9 comments · Fixed by #886
Closed

Reconnect only for outgoing peers #739

offerm opened this issue Dec 6, 2018 · 9 comments · Fixed by #886
Labels
bug Something isn't working p2p Peer to peer networking

Comments

@offerm
Copy link
Contributor

offerm commented Dec 6, 2018

Seen this on test2 server:

12/6/2018, 3:19:45 PM [P2P] error: peer error (03d2a862f7198143e96a08797e79c2ad86a09ee7a98494860cb1b9d73732c7e5bb): Peer (03d2a862f7198143e96a08797e79c2ad86a09ee7a98494860cb1b9d73732c7
e5bb) is stalling (56169410-f96a-11e8-ac3d-4f02ea5221a6)
12/6/2018, 3:19:45 PM [ORDERBOOK] debug: removed all orders for peer 03d2a862f7198143e96a08797e79c2ad86a09ee7a98494860cb1b9d73732c7e5bb
12/6/2018, 3:19:45 PM [P2P] debug: closing socket with peer 03d2a862f7198143e96a08797e79c2ad86a09ee7a98494860cb1b9d73732c7e5bb. reason: ResponseStalling
12/6/2018, 3:19:45 PM [P2P] debug: attempting to reconnect to a disconnected peer 03d2a862f7198143e96a08797e79c2ad86a09ee7a98494860cb1b9d73732c7e5bb
12/6/2018, 3:19:45 PM [P2P] warn: could not open connection to peer (03d2a862f7198143e96a08797e79c2ad86a09ee7a98494860cb1b9d73732c7e5bb): could not connect to peer at 127.0.0.1:9885: c
onnect ECONNREFUSED 127.0.0.1:9885
12/6/2018, 3:19:45 PM [P2P] info: Peer 03d2a862f7198143e96a08797e79c2ad86a09ee7a98494860cb1b9d73732c7e5bb socket closed
12/6/2018, 3:19:45 PM [P2P] debug: Connection attempt #1 to peer (127.0.0.1:9885) failed: connect ECONNREFUSED 127.0.0.1:9885. retrying in 5 sec...
12/6/2018, 3:19:50 PM [P2P] debug: Connection attempt #2 to peer (127.0.0.1:9885) failed: connect ECONNREFUSED 127.0.0.1:9885. retrying in 10 sec...
12/6/2018, 3:20:00 PM [P2P] debug: Connection attempt #3 to peer (127.0.0.1:9885) failed: connect ECONNREFUSED 127.0.0.1:9885. retrying in 20 sec...
12/6/2018, 3:20:20 PM [P2P] debug: Connection attempt #4 to peer (127.0.0.1:9885) failed: connect ECONNREFUSED 127.0.0.1:9885. retrying in 40 sec...
12/6/2018, 3:21:00 PM [P2P] debug: Connection attempt #5 to peer (127.0.0.1:9885) failed: connect ECONNREFUSED 127.0.0.1:9885. retrying in 80 sec...
12/6/2018, 3:22:20 PM [P2P] debug: Connection attempt #6 to peer (127.0.0.1:9885) failed: connect ECONNREFUSED 127.0.0.1:9885. retrying in 160 sec...
12/6/2018, 3:25:00 PM [P2P] debug: Connection attempt #7 to peer (127.0.0.1:9885) failed: connect ECONNREFUSED 127.0.0.1:9885. retrying in 320 sec...
12/6/2018, 3:30:20 PM [P2P] debug: Connection attempt #8 to peer (127.0.0.1:9885) failed: connect ECONNREFUSED 127.0.0.1:9885. retrying in 640 sec...
12/6/2018, 3:41:00 PM [P2P] debug: Connection attempt #9 to peer (127.0.0.1:9885) failed: connect ECONNREFUSED 127.0.0.1:9885. retrying in 1280 sec...
12/6/2018, 4:02:21 PM [P2P] debug: Connection attempt #10 to peer (127.0.0.1:9885) failed: connect ECONNREFUSED 127.0.0.1:9885. retrying in 2560 sec...
12/6/2018, 4:45:01 PM [P2P] debug: Connection attempt #11 to peer (127.0.0.1:9885) failed: connect ECONNREFUSED 127.0.0.1:9885. retrying in 3600 sec...
12/6/2018, 5:45:01 PM [P2P] debug: Connection attempt #12 to peer (127.0.0.1:9885) failed: connect ECONNREFUSED 127.0.0.1:9885. retrying in 3600 sec...
12/6/2018, 6:45:01 PM [P2P] debug: Connection attempt #13 to peer (127.0.0.1:9885) failed: connect ECONNREFUSED 127.0.0.1:9885. retrying in 3600 sec...

We should eliminate such reconnection.

@kilrau kilrau added bug Something isn't working p2p Peer to peer networking labels Dec 7, 2018
@kilrau kilrau added this to the 1.0.0-alpha.7 milestone Dec 7, 2018
@moshababo
Copy link
Collaborator

That's how it was implemented according to this proposal.
If you have a different idea on how to do it, let's discuss it here.

@offerm
Copy link
Contributor Author

offerm commented Dec 7, 2018

I'm not sure how this is related to the link.

The problem is that we try to connect to localhost:9885 but there is no XUD listening on it.
Somehow we got wrong information, we failed to validate it and we are using it.

Let's agree that it is wrong and find a way to fix it.

@moshababo
Copy link
Collaborator

I thought you’re referring to the multiple connection attempts.

From what the logs tell, we’re reconnecting after we disconnected due to ResponseStalling, and we’re applying connection retries on it. If the peer was outbound, it’s the address we were connected to. If it was inbound, it’s the first address from his advertised addresses list.

What from these do you find problematic?

@offerm
Copy link
Contributor Author

offerm commented Dec 10, 2018

XUD2 does not have and never had xud process running on port 9885.

Yet, the connection retry is done on (127.0.0.1:9885).

I'm not saying that there is a problem with the connection mechanism, but let's agree that there is a problem if the outcome is that xud2 is trying to connect to wrong host/port.

@moshababo
Copy link
Collaborator

Did XUD2 advertised 127.0.0.1:9885 address?

@offerm
Copy link
Contributor Author

offerm commented Dec 10, 2018 via email

@moshababo
Copy link
Collaborator

Then i'll need steps to reproduce.

@offerm
Copy link
Contributor Author

offerm commented Dec 11, 2018

A connects to B.
A advertise that it listens on 127.0.0.1:9885
connection between A and B dropped

Result:
B will try to connect to A using 127.0.0.1:9885

@offerm
Copy link
Contributor Author

offerm commented Dec 11, 2018

As I suggested before - since the advertise addresses are not reliable we better not try to reconnect an incoming connection. Incoming connection may also fail for other reasons (FW, NAT, etc).

@kilrau kilrau modified the milestones: 1.0.0-alpha.7, 1.0.0-alpha.8 Jan 2, 2019
@moshababo moshababo changed the title reconnection problem Reconnect to peer after disconnection (bug) Jan 6, 2019
@kilrau kilrau modified the milestones: 1.0.0-alpha.7, 1.0.0-alpha.8 Jan 23, 2019
@moshababo moshababo modified the milestones: 1.0.0-alpha.8, 1.0.0-alpha.9 Feb 4, 2019
@moshababo moshababo assigned ghost and unassigned moshababo Mar 5, 2019
@ghost ghost changed the title Reconnect to peer after disconnection (bug) Reconnect only for outgoing peers Mar 6, 2019
@kilrau kilrau modified the milestones: 1.0.0-alpha.11, 1.0.0-sprint.12 Mar 25, 2019
@kilrau kilrau modified the milestones: 1.0.0-sprint.12, 1.0.0-sprint.13 Mar 26, 2019
@ghost ghost added the in progress label Apr 14, 2019
@ghost ghost closed this as completed in #886 Apr 16, 2019
@ghost ghost removed the in progress label Apr 16, 2019
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working p2p Peer to peer networking
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants