Multiple connections established over a relay but Docs claim it's impossible

The Docs at https://docs.syncthing.net/advanced/device-numconnections.html state:

Multiple connections cannot be established over relays.

However, I’ve set the number of connections to 3 on all devices, and now I’m seeing this at the very moment:

The same device on yet another device uses only a single connection though:

Any ideas what is going on? Are the Docs wrong :upside_down_face:?

I don’t think so, so I think something else is going on; maybe one relay connection and one something else. Details would tell, from log or API.

Edit: Thinking further about it, I think it’s at least theoretically possible to establish one relay connection in each direction, if the two devices are listening on different relays. So that could be it. It’ll require some lucky timing as neither side will attempt another relay connection once one is already established.

I’ve tried to track when the connection was established, however I think it’s too late now, as the logs are truncated and https://docs.syncthing.net/events/deviceconnected.html outputs nothing.

Edit:

I’ve found the log:

[D4DZU] 2023/10/20 23:26:10 INFO: Established secure connection to UDPWEVD at 10.0.0.3:51812-5.45.97.191:22067/relay-client/TLS1.3-TLS_AES_128_GCM_SHA256/WAN-P50-5SFTNKGPSM5V0NKAALERBN1J2E
[D4DZU] 2023/10/21 00:13:02 INFO: Lost primary connection to UDPWEVD at 10.0.0.3:51812-5.45.97.191:22067/relay-client/TLS1.3-TLS_AES_128_GCM_SHA256/WAN-P50-5SFTNKGPSM5V0NKAALERBN1J2E: reading message: unexpected EOF (0 remain)
[D4DZU] 2023/10/21 00:13:02 INFO: Connection to UDPWEVD at 10.0.0.3:51812-5.45.97.191:22067/relay-client/TLS1.3-TLS_AES_128_GCM_SHA256/WAN-P50-5SFTNKGPSM5V0NKAALERBN1J2E closed: reading message: unexpected EOF
[D4DZU] 2023/10/21 00:14:48 INFO: Established secure connection to UDPWEVD at 10.0.0.3:54722-212.227.183.93:443/relay-server/TLS1.3-TLS_AES_128_GCM_SHA256/WAN-P50-5SFU2898OIHR8T7RMDRSHB6U0I
[D4DZU] 2023/10/21 10:35:12 INFO: Lost primary connection to UDPWEVD at 10.0.0.3:54722-212.227.183.93:443/relay-server/TLS1.3-TLS_AES_128_GCM_SHA256/WAN-P50-5SFU2898OIHR8T7RMDRSHB6U0I: closed by remote: Syncthing is being stopped (0 remain)
[D4DZU] 2023/10/21 10:35:12 INFO: Connection to UDPWEVD at 10.0.0.3:54722-212.227.183.93:443/relay-server/TLS1.3-TLS_AES_128_GCM_SHA256/WAN-P50-5SFU2898OIHR8T7RMDRSHB6U0I closed: closed by remote: Syncthing is being stopped
[D4DZU] 2023/10/21 10:37:00 INFO: Established secure connection to UDPWEVD at 10.0.0.3:60422-212.227.183.93:443/relay-server/TLS1.3-TLS_AES_128_GCM_SHA256/WAN-P50-5SG2A2A7H94COV0MH2GNAVKP7E
[D4DZU] 2023/10/22 00:14:34 INFO: Established secure connection to UDPWEVD at 10.0.0.3:49874-212.227.183.93:443/relay-server/TLS1.3-TLS_AES_128_GCM_SHA256/WAN-P50-5SG7SH111SOM8VHGHEQ09BLADI
[D4DZU] 2023/10/22 00:14:36 INFO: Lost secondary connection to UDPWEVD at 10.0.0.3:49874-212.227.183.93:443/relay-server/TLS1.3-TLS_AES_128_GCM_SHA256/WAN-P50-5SG7SH111SOM8VHGHEQ09BLADI: closed by remote: handling index-update for 7vafc-tydfh: 7vafc-tydfh: folder is not running (1 remain)
[D4DZU] 2023/10/22 00:17:01 INFO: Lost primary connection to UDPWEVD at 10.0.0.3:60422-212.227.183.93:443/relay-server/TLS1.3-TLS_AES_128_GCM_SHA256/WAN-P50-5SG2A2A7H94COV0MH2GNAVKP7E: read timeout (0 remain)
[D4DZU] 2023/10/22 00:17:01 INFO: Connection to UDPWEVD at 10.0.0.3:60422-212.227.183.93:443/relay-server/TLS1.3-TLS_AES_128_GCM_SHA256/WAN-P50-5SG2A2A7H94COV0MH2GNAVKP7E closed: read timeout
[D4DZU] 2023/10/22 00:17:17 INFO: Established secure connection to UDPWEVD at 10.0.0.3:50001-194.36.145.209:22067/relay-client/TLS1.3-TLS_AES_128_GCM_SHA256/WAN-P50-5SG7T3V37TG28VKEAJS7OT19LM
[D4DZU] 2023/10/22 02:19:20 INFO: Lost primary connection to UDPWEVD at 10.0.0.3:50001-194.36.145.209:22067/relay-client/TLS1.3-TLS_AES_128_GCM_SHA256/WAN-P50-5SG7T3V37TG28VKEAJS7OT19LM: writing message: write tcp 10.0.0.3:50001->194.36.145.209:22067: wsasend: An existing connection was forcibly closed by the remote host. (0 remain)
[D4DZU] 2023/10/22 02:19:20 INFO: Connection to UDPWEVD at 10.0.0.3:50001-194.36.145.209:22067/relay-client/TLS1.3-TLS_AES_128_GCM_SHA256/WAN-P50-5SG7T3V37TG28VKEAJS7OT19LM closed: writing message: write tcp 10.0.0.3:50001->194.36.145.209:22067: wsasend: An existing connection was forcibly closed by the remote host.
[D4DZU] 2023/10/22 02:19:43 INFO: Established secure connection to UDPWEVD at 10.0.0.3:56071-194.36.145.209:22067/relay-client/TLS1.3-TLS_AES_128_GCM_SHA256/WAN-P50-5SG8NR4O01V0GLT9F66L5IVDUU
[D4DZU] 2023/10/22 02:19:49 INFO: Established secure connection to UDPWEVD at 10.0.0.3:56078-212.227.183.93:443/relay-server/TLS1.3-TLS_AES_128_GCM_SHA256/WAN-P50-5SG8NRRSGJVS0816UTK80K26KM

The last two lines mention two different relay IP addresses.

Is this really that lucky? The device in question has now switched to using just 1 connection, however another device, which was using 1 connection before, now displays 2 connections in the same manner as the other one did :slight_smile:.

This is all happening in a set of just 10 devices or so, so not a huge number.

Well, it’s within a few seconds. But the need for luck is somewhat reduced by synchronisation;

[D4DZU] 2023/10/22 02:19:20 INFO: Lost primary connection to UDPWEVD at 10.0.0.3:50001-194.36.145.209:22067/relay-client/TLS1.3-TLS_AES_128_GCM_SHA256/WAN-P50-5SG7T3V37TG28VKEAJS7OT19LM: writing message: write tcp 10.0.0.3:50001->194.36.145.209:22067: wsasend: An existing connection was forcibly closed by the remote host. (0 remain)
[D4DZU] 2023/10/22 02:19:20 INFO: Connection to UDPWEVD at 10.0.0.3:50001-194.36.145.209:22067/relay-client/TLS1.3-TLS_AES_128_GCM_SHA256/WAN-P50-5SG7T3V37TG28VKEAJS7OT19LM closed: writing message: write tcp 10.0.0.3:50001->194.36.145.209:22067: wsasend: An existing connection was forcibly closed by the remote host.
[D4DZU] 2023/10/22 02:19:43 INFO: Established secure connection to UDPWEVD at 10.0.0.3:56071-194.36.145.209:22067/relay-client/TLS1.3-TLS_AES_128_GCM_SHA256/WAN-P50-5SG8NR4O01V0GLT9F66L5IVDUU
[D4DZU] 2023/10/22 02:19:49 INFO: Established secure connection to UDPWEVD at 10.0.0.3:56078-212.227

Two devices are connected via relay. Connection is lost. Both attempt a relay connection, both get established, one in either direction. I don’t think it’s particularly advantageous, it’s also not harmful. I’m OK with it.