-
Notifications
You must be signed in to change notification settings - Fork 672
Indefinite reconnects occur if two peers are launched referencing each other #478
Comments
I suspect this is due to the to the fact that when we construct the |
+1 |
Hi @fermayo - it turns out this is not a bug, rather a consequence of behaviour that is required to make weave work properly in the presence of network address translation. In essence, the weave router cannot assume that if it has an inbound connection from a particular IP from a particular peer, that connecting back to that IP leads back to the same peer. Furthermore, even when it does turn out to be the same peer we cannot cache that information and prevent further reconnects because in the general case we need to be able to support changing NAT mappings and mobile hosts. One option would be to add a command line flag that instructs weave that NAT isn't being used between any peers in a weave network ( |
Ok, I understand. So maybe we could hide the logs (in the default logging level) after the first connection attempt fails with |
I don't think ordinary NAT is an issue here. As of #451, weave generally won't attempt to connect to the ephemeral ports you'd typically see as the sources of NAT'ed connections. We only connect to the standard weave port of such addresses. The odds of finding different peers there over time are small. Same goes for non-NAT'ed connections. Mobile peers, i.e. peers that keep changing IPs, possibly cycling through a common IP space, is a different matter. I'd be surprised if that was a common weave deployment scenario though. |
A public cloud (e.g. EC2) where IP addresses are recycled by machines coming and going is another scenario where we can't rely on finding the same peer at a given IP address over time. |
The "finding a different peer at the same address over time" issue is a red herring. A weave peer attempts to connect to:
...in all cases only if it does not already have a connection to that IP:port. The proposed change is to introduce a flag that controls whether the port is relevant in that test. This does not affect weave's ability to discover a different peer at the same IP address over time. |
@fermayo Are you aware of any configuration in your current/planned deployments where a single weave peer would be required to make multiple outbound connections to same IP but different ports? |
Incidentally, resolving #412 would probably cut down on log noise a fair bit. |
@rade no, we don't have any plans to do that |
I wonder whether a flag is really the right approach here. Really the property is associated with the individual addresses supplied on the command line. e.g. one wants to be able to say "connect to this address", or "connect to this address only if I don't already have a connection to the same IP". How about we base that decision on whether a port has been supplied? i.e. supplying an address w/o a port means "connect to this address on the standard port, but only if there isn't already a connection to that IP". |
Can we think of common scenarios where a user would want their weave to "connect to this address on this non-standard port, but only if there isn't already a connection to that IP"? Bear in mind that the standard port is configurable these days. |
...though not properly, and in a documented way, until #551 gets merged. |
If a peer was specified on the command line w/o a port, then do not connect to it if we have inbound connections from that IP. This eliminates unnecessary (and ultimately failing0 connection attempts in the common scenario of several peers having been told about each other on their command lines. Closes weaveworks#478.
more discriminate connectivity Closes #478.
See @nordbergm's comment in issue #341 for original report. If two peers are launched simultaneously referencing each other by IP, they will establish connectivity (confirmed with
weave status
on each peer) however one of them will also be trying to reconnect to the other periodically, an attempt which fails as there is already a connection between the peers.The text was updated successfully, but these errors were encountered: