arvidn / libtorrent

an efficient feature complete C++ bittorrent implementation
http://libtorrent.org
Other
5.27k stars 997 forks source link

Internet connection slows down to a crawl with libtorrent > 1.2.5. #4739

Closed Alexey104 closed 4 years ago

Alexey104 commented 4 years ago

libtorrent version (or branch): 1.2.7-1 platform/architecture: ArchLinux

Hi! I have an annoying problem with latest libtorrent versions(> 1.2.5) which i have never had with older versions(before 1.2.6). My torrent client always worked day and night seeding about 200 torrents without any problems, and I have never experienced any network problems due to it. Problems started after upgrading libtorrent from 1.2.5 to 1.2.6. I noticed that after 10-15 minutes of seeding my internet connection slows down to a point when it becomes completely unusable - websites are either not loading or loading incredibly slow, wi-fi devices are loosing connection with the router, I cannot even ping google.com. My router is TP-Link Archer A6 which is a cheap one and may be not very powerful for torrenting, but, as I said, it works fine with libtorrent <=1.2.5, and I can seed 400-500 Gigs-a-day without any noticeable influence on my network. I have this behavior with both deluge and qBittorrent, so it is not related to certain client.

As a temporary workaround i decreased the global maximum number of connections in the client from 500 to 200, which solved the problem when using libtorrent 1.2.6. But tonight I upgraded libtorrent to 1.2.7 from arch repos, and things became even worse after that. With 1.2.7 i cannot use network even with global maximum connections limited to 100. Finally, I downgraded to 1.2.5, and the issue is completely gone, my network works fine again regardless of seeding torrents.

Am I the only one who experience this? What info should I provide for further investigation? Thanks in advice!

arvidn commented 4 years ago

did it work well in libtorrent 1.2.5 but not in 1.2.6? did any of your settings change? e.g. mixed_mode_algorithm, or any utp_* settings?

arvidn commented 4 years ago

there were some changes to UPnP. do you see a change in UPnP working between those versions?

petersasi commented 4 years ago

I have used each of these libtorrent versions in Win10 Deluge2 seeding almost 2000 torrents, without experiencing such problems. My first suspicion would be if your router happens to have stateful packet filtering turned on and maybe running out of resources (say if LT 1.2.6 and 7 uses more TCP than 1.2.5 used to...) Just guessing though...

arvidn commented 4 years ago

another possibility, along those lines, is that the NAT may be running out of space in the pinholes table because of DHT traffic. You could experiment with disabling the DHT.

Alexey104 commented 4 years ago

Thank you for your response! I think, my problem is solved now.

there were some changes to UPnP. do you see a change in UPnP working between those versions?

I inspected UPnP queries with wireshark and found out that the port i am using for torrent clients is forwarded to an external IP which is 10.192.XX.XXX. I realized that my ISP switched me to Carrier Grade NAT, so I am using a "gray" IP. The port was opened on my router, but it was unreachable from the internet. I called to my ISP, got a "white" IP from them, reconfigured my router, checked that the appropriate port is opened and visible from the web, and now all seems to be working fine.

I'm not sure if it was the reason of my initial problem(could it be?), but now my network is working fine. I will do more tests and write back if encounter any problems.

Alexey104 commented 4 years ago

My problem came back after a while, but now, after some further tests, I can definitely say that disabling DHT finally solved it for me. I am still able to use DHT with 1.2.5 without any problems though. Anyway, I guess I should get more powerful network equipment for torrenting since it seems that nobody else besides me has this issue.

Alexey104 commented 4 years ago

To avoid the problem I can also set mixed_mode_algorithm from 0 to default 1. It helps, but my download speed decreases from 60-70 M/s to 30-40 M/s.

MassaRoddel commented 4 years ago

What brings down my router is IPv6 DHT. To the point there only reconnecting to the ISP helps. Existing connections keep their speed but starting new ones gets slower and slower until the connect attempts timeout. Therefore I have disabled IPv6 DHT. (I do not use libtorrents DHT)

Alexey104 commented 4 years ago

I have replaced my router with a more powerful one and don't have problems anymore.