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

Qbittorrent TOTALLY ignores upload speed limits #6292

Closed
ShadowOfHarbringer opened this issue Jan 24, 2017 · 36 comments
Closed

Qbittorrent TOTALLY ignores upload speed limits #6292

ShadowOfHarbringer opened this issue Jan 24, 2017 · 36 comments

Comments

@ShadowOfHarbringer
Copy link

ShadowOfHarbringer commented Jan 24, 2017

qBittorrent version and Operating System:

3.3.7 / 3.3.10

If on linux, libtorrent and Qt version:

Kubuntu 16.04, Linux 4.4.0-59-generic #80-Ubuntu SMP
libtorrent-rasterbar8 (1.0.10-1ppa1~xenial1)
Qt 5.5.1 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 5.3.1 20160413) on "xcb"

What is the problem:

Completely ignored upload speed limits.

What is the expected behavior:

Qbittorrent should at least try to honor the settings

Steps to reproduce:

  1. Start Qbittorrent
  2. Set an Upload speed limit (like 40K/s)
  3. Start seeding
  4. ???
  5. Watch Qbittorrent upload at 100 or 200K per second, while the setting is 40K/s
    REPRODUCTIBLE: ALWAYS.

Extra info(if any):

I am using OpenVPN to a remote VPS, not sure if it changes anything. No other application is having behavioral problems because of it.

Restarting Qbittorrent does not help.

@ShadowOfHarbringer
Copy link
Author

I have just updated to v3.3.10

The issue persists. While global upload limit is set to 40K/s, even individual torrents often exceed 100K/s, not saying about the whole thing.

@ShadowOfHarbringer
Copy link
Author

Update: added libtorrent and QT version info.

libtorrent-rasterbar8 (1.0.10-1ppa1~xenial1)
Qt 5.5.1 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 5.3.1 20160413) on "xcb"

@Seeker2
Copy link

Seeker2 commented Jan 24, 2017

Possibly same issue as here: No Upload Limit #6214

Are you telling qBitTorrent to limit uTP speeds?

@ShadowOfHarbringer
Copy link
Author

Nope, uTP is turned off.

@Seeker2
Copy link

Seeker2 commented Jan 24, 2017

How many peers are being uploaded to at once?
Is 1 or more "hogging" most of this excess upload speed? (may be a remote exploit)

@ShadowOfHarbringer
Copy link
Author

ShadowOfHarbringer commented Jan 24, 2017

Something around 30 peers.

Please check out the screenshot provided. Note that upload speed is set at 40K/sec.

https://i.imgur.com/4wrQDoN.png

I have multiple SINGLE torrents often far exceeding 40K/s and together it's way over 300K/s.

Seems I will have to go back to Vuze for now. I haven't used it in centuries...

@Seeker2
Copy link

Seeker2 commented Jan 24, 2017

There's a better chance of that being fixed if we knew more about your settings.

@ShadowOfHarbringer
Copy link
Author

Setttings screenshots coming up.

@ShadowOfHarbringer
Copy link
Author

Here you are. https://imgur.com/a/Rk3PL

Changed UI to english for your convenience

@naikel
Copy link
Contributor

naikel commented Jan 24, 2017

Maybe you are in alternative setting and you don't know?

It happened to me when I was starting using qBittorrent, since it's so easy to enable alternative setting and not realizing it changed.

The alternative mode CAN be enabled using the scheduler, but if you click on the icon it will enable it and believe me you won't notice it.

This is how it looks when alternative mode is enabled: http://i.imgur.com/ZMYoQ2y.png

@ShadowOfHarbringer
Copy link
Author

ShadowOfHarbringer commented Jan 24, 2017

"Maybe you are in alternative setting and you don't know?"

I have switched modes, restarted QBittorrent multiple times now. No effect, sorry.

At all times the upload speed shown on bottom panel was 40K/s. Also, the alternative mode was NOT enabled. And I am absolutely sure of it. I have checked multiple times.

@naikel
Copy link
Contributor

naikel commented Jan 24, 2017

The upload limit works wonders for me. It would be very weird that it doesn't work for you.

@ShadowOfHarbringer
Copy link
Author

The upload limit works wonders for me. It would be very weird that it doesn't work for you.

It is as if the setting had no effect whatsoever. Maybe the Linux build is broken ? Should I try Win32 version under WINE ?

@zeule
Copy link
Contributor

zeule commented Jan 24, 2017

Works for me in Gentoo, although I have µTP and limiting µTP enabled.

@naikel
Copy link
Contributor

naikel commented Jan 24, 2017

Nope, using qBittorrent with Debian Unstable (x64) here... that must not be the reason.

There must be something in your configuration that's causing it.

@naikel
Copy link
Contributor

naikel commented Jan 24, 2017

Just for testing set the alternative speed limit identical to the global speed limit

@ShadowOfHarbringer
Copy link
Author

ShadowOfHarbringer commented Jan 24, 2017

I have done so. https://i.imgur.com/mBLQBQv.png

  1. Set both normal and alternative to be the same.
  2. Restarted qbittorrent

No effect at all. It is as if the limits are not really applied. Looks that Qbittorrent is just pretending that he even takes them into consideration.

Actually, the download speed limits are also not perfectly aligned. They are up to 30% off often.

Just for your information, when I used Vuze many many years ago, the numbers were rarely more than 5% off.

But I would really rather use Qbittorent than the old Java resource hog.

@ShadowOfHarbringer
Copy link
Author

ShadowOfHarbringer commented Jan 24, 2017

OK guys, I have found the culprit. It's the VPN.

I had to check "Apply rate limits to peers on LAN" and everything magically worked. The limits are applied with maximum 1-2% error margin.

This issue name should be changed to "Qbittorrent does not apply speed limits when using VPN connection".

My default gateway is 10.xx.xx.1 and I guess Qbittorrent detects it and treats all incoming/outgoing traffic as going to/from LAN.

@zeule
Copy link
Contributor

zeule commented Jan 24, 2017

@ShadowOfHarbringer could you show ip address output to understand what addresses libtorrent can identify as LAN ones, please?

@Seeker2
Copy link

Seeker2 commented Jan 24, 2017

Your upload limit may also exceed 40 KB/sec when downloading close to the limit -- upload-side overheads from tracker updates, HAVE messages, DHT, PEX, LSD, and TCP/IP overheads from downloading. Raw overheads are also higher on a VPN due to encapsulation.

This might be possible even without uploading pieces to other peers.

@ShadowOfHarbringer
Copy link
Author

ShadowOfHarbringer commented Jan 25, 2017

@ShadowOfHarbringer could you show ip address output to understand what addresses libtorrent can identify as LAN ones, please?

OK.

My normal LAN IP: 192.168.1.47 (eth0)
My VPN local IP: 10.72.72.47 (tun0)

Important entries from routing table:
$ route -n
0.0.0.0 10.72.72.1 128.0.0.0 UG 0 0 0 tun0
0.0.0.0 192.168.1.5 0.0.0.0 UG 100 0 0 eth0
128.0.0.0 10.72.72.1 128.0.0.0 UG 0 0 0 tun0

Default gateway is 10.72.72.1.

@ShadowOfHarbringer
Copy link
Author

ShadowOfHarbringer commented Jan 25, 2017

There also is NAT redirection of incoming traffic on the VPS to the ports QBittorrent is using. So my ports are open from outside (checked).

@ShadowOfHarbringer
Copy link
Author

Your upload limit may also exceed 40 KB/sec when downloading close to the limit -- upload-side overheads from tracker updates, HAVE messages, DHT, PEX, LSD, and TCP/IP overheads from downloading. Raw overheads are also higher on a VPN due to encapsulation.

Yeah I know. But that is not it.

Actually because i checked "Apply rate limit to protocol overhead", that was never the case. Qbittorrent properly calculates & applies the limit.

@kkuriyama
Copy link

I am running qBittorrent v3.3.13 on FreeBSD 11.1 and have noticed that upload rate limits are not enforced. I can't find "Apply rate limits to peers on LAN" under Speed / Rate Limit Settings. Did that setting disappear?

@monkeylove
Copy link

Still taking place with v4.1.5. No problems with v3.3.6.

@ShadowOfHarbringer
Copy link
Author

I think I have kind of figured what the problem is about.

When I was using VPN previously, on the remove VPN server I had a simple default iptables config, widely used in port forwarding to client ip (found it many years ago on the internet):

iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 50000:50100 -j DNAT --to-destination 10.YY.YY.X:50000-50100
iptables -A FORWARD -p tcp -d 10.YY.YY.X --dport 50000:50100 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -A POSTROUTING -o tun1 -j MASQUERADE
iptables -t nat -A POSTROUTING -s 10.YY.YY.0/24 -o eth0 -j MASQUERADE

What this does, it port forwards all traffic coming on the interface eth0 in port range 50000-50100 on the server to the IP inside the VPN - 10.YY.YY.X.

Apparently, the problem with these rules is they do not route the information about incoming traffic IP to the client inside VPN.

Therefore, all outside traffic is visible in QBittorrent and other applications using the port forwards as the gateway IP inside the OpenVPN LAN (10.YY.YY.1). Also another issue is all hosts outside are visible for QBittorrent as a single host (10.YY.YY.1), which greatly reduces performance and makes the connection seen as firewalled by QBT most of the time.

I fixed it with the following rules, the problem no longer occurs:

iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 50000:50100 -j DNAT --to-destination 10.YY.YY.X:50000-50100
iptables -A FORWARD -p tcp -d 10.YY.YY.X --dport 50000:50100 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -A POSTROUTING -s 10.YY.YY.0/24 -o tun1 -j SNAT --to-source 10.YY.YY.1
iptables -t nat -A POSTROUTING -s 10.YY.YY.0/24 -o eth0 -j SNAT --to-source REMOTE.OVPN.SERVER.IP

Also, downloading works better, performance is increased, connection is less lagged and QBittorrent always sees incoming connections as possible immediately and persistently.

I am re-opening this so people can see the solution.

@Seeker2
Copy link

Seeker2 commented Dec 10, 2019

One of the supposed fixes in the recent libtorrent/qBitTorrent updates hints at another possible cause:
IPv6 peers and seeds don't count against the speed limits due to a bug or bugs.

@shanktank
Copy link

Problem exists on 4.2.0. Notably, I'm not using any sort of VPN, and no configuration allows the upload speed limiter to work (disabling uTP, enabling any/all rate limit settings).

@naikel
Copy link
Contributor

naikel commented Dec 10, 2019

Upload speed limiter has always work wonders for me. I'm on Arch. I have IPv6 disabled. I have never ever had a problem with the limiter.

@FranciscoPombal
Copy link
Member

One of the supposed fixes in the recent libtorrent/qBitTorrent updates hints at another possible cause:
IPv6 peers and seeds don't count against the speed limits due to a bug or bugs.

Interesting. Does this still happen with IPv6 even if you have all of the following checkboxes selected:

  • Preferences -> Speed -> Apply rate limit to uTP protocol
  • Preferences -> Speed -> Apply rate limit to transport overhead
  • Preferences -> Speed -> Apply rate limit to peers on LAN

For everybody else in this thread, besides the IPv6, does qBItorrent still exceed the limits even with the above mentioned checkboxes selected?

@ShadowOfHarbringer
Copy link
Author

The bug does not occur anymore to me.

After I applied the IPtables rules to my VPN, QBittorrent properly recognizes and differentiates between LAN peers and remote peers. Limits work as designed.

To fix all kinds of issues like this for future users, I propose that QBittorrent should treat all traffic from TUN/TAP and similar interfaces as a remote traffic by default.

@ShadowOfHarbringer
Copy link
Author

In the meanwhile, a Quick workaround is checking "Apply rate limit to peers on LAN" checkbox in Preferences -> Speed.

@ShadowOfHarbringer
Copy link
Author

Do you use VPN?

@Niproblema
Copy link

Niproblema commented Dec 25, 2019

I am having this issue also, ver 4.1.9.1
Global limit is being disregarded and torrent specific limit is applied.
speeed

Limiting each torrent works, but the global limit doesn't.

Also seems like restarting client resolves the issue temporarily.

@icsterm
Copy link

icsterm commented Dec 26, 2019

This happens to me too on W10 but with download, I'm on latest v4.2.1, uTP only mode, all 3 of the 'apply rate limit' options are ticked.
I use VPN but it's done on the router so I don't have any TAP or special adapter.
I also have my network adapter manually selected and the IPv4 address too.
I don't have IPv6 connectivity of any sort.

There must be some new bug in the latest builds.

speed_limit

@FranciscoPombal
Copy link
Member

Duplicate of #8433

@FranciscoPombal FranciscoPombal marked this as a duplicate of #8433 Feb 28, 2020
@qbittorrent qbittorrent locked and limited conversation to collaborators Mar 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests