synapse icon indicating copy to clipboard operation
synapse copied to clipboard

Synapse creates a large number of connections at once

Open aereaux opened this issue 4 years ago • 5 comments

About every minute synapse creates a very large number of connections (several thousand). This causes my internet connection to lose packets and for the ping latency to jump to several seconds. Is there something I can configure in synapse to stop this from happening?

aereaux avatar Sep 09 '20 15:09 aereaux

Hmm, it's not immediately clear as to why this could happen. Have you tried reducing max_open_socket and max_open_announces? Do you know what sort of connections these are (DNS, HTTP, UDP, Bittorrent)?

Luminarys avatar Sep 15 '20 02:09 Luminarys

I'm not very experienced at debugging network issues like this. Is the best way to tell what sort of connections they are using wireshark or tcpdump? I tried reducing the limits listed in the config file to 40 and 5 respectively, and it seems to shortened the duration of the interruption but not gotten rid of it.

aereaux avatar Sep 15 '20 14:09 aereaux

My best guess is that this is peer connections. I think using wireshark should be informative, see if the connections opened use the bittorrent protocol and if there's a pattern in IP addresses being connected to. It might be possible that your tracker is returning many connections which Synapse is attempting to connect to in succession. Because we don't limit opened connections from tracker responses I would also check what the tracker response is and if it contains many peer IPs since this could be caused by a very large tracker response.

Luminarys avatar Sep 16 '20 04:09 Luminarys

Both of the torrents I have loaded are archlinux iso images that I got from magnet links. As far as I can tell, they don't have trackers. After some more experimentation, it looks like the traffic spike is from DHT, The traffic is all (or most?) UDP on the DHT port that is configured in my config, and it looks like it stops when I disable DHT (although that means I can't download anything). Is there some way I can limit this?

aereaux avatar Sep 16 '20 18:09 aereaux

I see, DHT also makes sense as a culprit. As of right now there is no config on the number of peers returned from a response, this is something I'll add. For the time being, you can control the vector used by modifying this line to limit peers processed: https://github.com/Luminarys/synapse/blob/7785d5fa20da22c08bf640f1ed51233e6ad5f74c/src/control/mod.rs#L310

Luminarys avatar Sep 17 '20 04:09 Luminarys