qBittorrent sent different PeerID on every port #14848

Open
opened 2026-02-22 01:29:44 -05:00 by deekerman · 13 comments
Owner

Originally created by @SeaHOH on GitHub (Jul 31, 2023).

qBittorrent & operating system versions

First at all, I am not a qBittorrent user now. Because newest version of qBittorrent always crash and made system down, my PC run on old Windows 7 and old hardware. (6.1.760x)

qBittorrent: 4.3 - 4.5 (actual observed)

What is the problem?

qBittorrent sent different PeerID on every port, even for same torrent, same network interface (IP).

This behavior is ABSOLUTELY NOT a feature, it is a BUG. It led peers connected to qBittorrent peer more than once (e.g. incoming and outgoing) in a same time, then qBittorrent peer disconnected the previous connection, that is very bad to unpopular torrents.

Steps to reproduce

  1. Start any Bittorrent client that can provides Peers List feature.
  2. Load a popular torrent, then limit the incoming speed to 10kb/s. (that simulate a unpopular&undead torrent)
  3. Observe the Peers List.
  4. After a few minutes, some qBittorrent peers will be appeared, which has same IP but different ports and PeerIDs.

Additional context

No response

Log(s) & preferences file(s)

No response

Originally created by @SeaHOH on GitHub (Jul 31, 2023). ### qBittorrent & operating system versions First at all, I am not a qBittorrent user now. Because newest version of qBittorrent always crash and made system down, my PC run on old Windows 7 and old hardware. (6.1.760x) qBittorrent: 4.3 - 4.5 (actual observed) ### What is the problem? qBittorrent sent different PeerID on every port, even for same torrent, same network interface (IP). This behavior is ABSOLUTELY NOT a feature, it is a BUG. It led peers connected to qBittorrent peer more than once (e.g. incoming and outgoing) in a same time, then qBittorrent peer disconnected the previous connection, that is very bad to unpopular torrents. ### Steps to reproduce 1. Start any Bittorrent client that can provides Peers List feature. 1. Load a popular torrent, then limit the incoming speed to 10kb/s. (that simulate a unpopular&undead torrent) 1. Observe the Peers List. 1. After a few minutes, some qBittorrent peers will be appeared, which has same IP but different ports and PeerIDs. ### Additional context _No response_ ### Log(s) & preferences file(s) _No response_
Author
Owner

@stalkerok commented on GitHub (Jul 31, 2023):

If I understand you correctly, then you have different ports due to the fact that you do not have a dedicated external ip address, so your Internet provider will forward random ports at its discretion and change them.
You can also use the function "Allow multiple connections from the same IP address"

@stalkerok commented on GitHub (Jul 31, 2023): If I understand you correctly, then you have different ports due to the fact that you do not have a dedicated external ip address, so your Internet provider will forward random ports at its discretion and change them. You can also use the function "Allow multiple connections from the same IP address"
Author
Owner

@SeaHOH commented on GitHub (Jul 31, 2023):

If I understand you correctly, then you have different ports due to the fact that you do not have a dedicated external ip address, so your Internet provider will forward random ports at its discretion and change them.

This issue is not about my network and Internet provider, it is qBittorrent's. I do not use qBittorrent, my Internet provider provides Global IP address for me.

You can also use the function "Allow multiple connections from the same IP address"

Again, I do not use qBittorrent. Even I enabled the function, but others may not.
One more again, this issue is not about multiple connections, it is PeerID.

@SeaHOH commented on GitHub (Jul 31, 2023): > If I understand you correctly, then you have different ports due to the fact that you do not have a dedicated external ip address, so your Internet provider will forward random ports at its discretion and change them. This issue is not about my network and Internet provider, it is qBittorrent's. I do not use qBittorrent, my Internet provider provides Global IP address for me. > You can also use the function "Allow multiple connections from the same IP address" Again, I do not use qBittorrent. Even I enabled the function, but others may not. One more again, this issue is not about multiple connections, it is PeerID.
Author
Owner

@glassez commented on GitHub (Jul 31, 2023):

@SeaHOH
Could you provide a screenshot of how does it look like in your Peer List?

@glassez commented on GitHub (Jul 31, 2023): @SeaHOH Could you provide a screenshot of how does it look like in your Peer List?
Author
Owner

@SeaHOH commented on GitHub (Jul 31, 2023):

Here are the screenshots (incoming and outgoing connections).

For qBittorrent.
list_qb
peers_qb

For BitComet, it keeps the consistency even via different IP for same torrent.
peers_bc

Part situation of other clients: μTorrent has the same bug, Tixati and Transmission do not.

@SeaHOH commented on GitHub (Jul 31, 2023): Here are the screenshots (incoming and outgoing connections). For qBittorrent. ![list_qb](https://github.com/qbittorrent/qBittorrent/assets/8470820/fec92955-ff45-4e78-ac7d-f9a309f3699d) ![peers_qb](https://github.com/qbittorrent/qBittorrent/assets/8470820/2967a747-8fb9-4ee1-849b-867fd9c3f257) For BitComet, it keeps the consistency even via different IP for same torrent. ![peers_bc](https://github.com/qbittorrent/qBittorrent/assets/8470820/03a1b0a2-858d-49f8-b21b-8088a1c3dc5c) Part situation of other clients: μTorrent has the same bug, Tixati and Transmission do not.
Author
Owner

@stalkerok commented on GitHub (Aug 1, 2023):

I will just note that port 6881 is the default port for some devices.
https://www.google.com/search?q=port+6881+used+for
https://www.google.com/search?q=port+6881+bittorrent

@stalkerok commented on GitHub (Aug 1, 2023): I will just note that port 6881 is the default port for some devices. https://www.google.com/search?q=port+6881+used+for https://www.google.com/search?q=port+6881+bittorrent
Author
Owner

@SeaHOH commented on GitHub (Aug 1, 2023):

I will just note that port 6881 is the default port for some devices.

I said "every port".

@SeaHOH commented on GitHub (Aug 1, 2023): > I will just note that port 6881 is the default port for some devices. I said "every port".
Author
Owner

@glassez commented on GitHub (Aug 1, 2023):

Seems that libtorrent uses different peer id even for each peer connection for whatever reason.
I created #7479. You could participate there as an affected person.

@glassez commented on GitHub (Aug 1, 2023): Seems that **libtorrent** uses different peer id even for each peer connection for whatever reason. I created [#7479](https://github.com/arvidn/libtorrent/issues/7479). You could participate there as an affected person.
Author
Owner

@SeaHOH commented on GitHub (Aug 1, 2023):

@glassez Thanks very much! But I do not know what else to add to, I will keep quiet until someone mentions me.

@SeaHOH commented on GitHub (Aug 1, 2023): @glassez Thanks very much! But I do not know what else to add to, I will keep quiet until someone mentions me.
Author
Owner

@glassez commented on GitHub (Aug 1, 2023):

@SeaHOH
I meant that you could track that issue (e.g. subscribe to it).

@glassez commented on GitHub (Aug 1, 2023): @SeaHOH I meant that you could track that issue (e.g. subscribe to it).
Author
Owner

@arvidn commented on GitHub (Aug 26, 2023):

It led peers connected to qBittorrent peer more than once (e.g. incoming and outgoing) in a same time, then qBittorrent peer disconnected the previous connection, that is very bad to unpopular torrents.

I don't think this is a correct conclusion.

The mechanism that mitigates redundant connections is primarily based on having one connection per IP. I suspect that you enabled allow_multiple_connections_per_ip. It's not recommended as the redundant connection logic is not as good. Perhaps you have a good reason.

regarding the peed-id, I posted some more details here.

@arvidn commented on GitHub (Aug 26, 2023): > It led peers connected to qBittorrent peer more than once (e.g. incoming and outgoing) in a same time, then qBittorrent peer disconnected the previous connection, that is very bad to unpopular torrents. I don't think this is a correct conclusion. The mechanism that mitigates redundant connections is primarily based on having one connection per IP. I suspect that you enabled `allow_multiple_connections_per_ip`. It's not recommended as the redundant connection logic is not as good. Perhaps you have a good reason. regarding the peed-id, I posted some more details [here](https://github.com/arvidn/libtorrent/issues/7479#issuecomment-1694214585).
Author
Owner

@SeaHOH commented on GitHub (Aug 26, 2023):

I suspect that you enabled allow_multiple_connections_per_ip.

Ok, I will ask the devs to check.

@SeaHOH commented on GitHub (Aug 26, 2023): > I suspect that you enabled `allow_multiple_connections_per_ip`. Ok, I will ask the devs to check.
Author
Owner

@SeaHOH commented on GitHub (Sep 1, 2023):

@arvidn
In https://forum.tixati.com/support/7807 , the devs hasn't answered yet for now time. And, an user notaLamer commented some views, his English is better than me, please take a look at.

Hello, I believe arvidn misunderstood you there. He thinks you are using qbittorrent.
I think from the screenshots you have shown, it's the duplicated remote qbittorrent peer (the one from China) who terminates the connection.

The following situation, correct me if wrong and if right please repost on github:

  • You with Tixati see two different peers. (a) the destination ip:port:(tcp,udp) are different (b) the peer IDs are different

  • Tixati is CORRECT to assume in both cases that it sees TWO peers.

  • The qbittorrent client may or may not know about the two different IPs it has on the outside. It sees Tixati connecting with (a) same IP:port:protocol (b) same peer ID.

  • This remote client is the only one who has the information to conclude the second connection is a duplicate.

  • It closes the 2nd connection, but Tixati does NOT know why. It tries again later.

If correct then Tixati is not at fault other than continuing to try.

There are two decisions in qbittorrent that lead to this:

  1. Only allowing one connection per IP. This will get worse as IPv4 addresses will become shared between more users. Including VPN users.
  2. Totally randomizing peer ID.

The reason why you noticed is because Tixati is a unique client in that it keeps recent peers in the list for a long time. Other clients would show them at all. I would bet your qbittorrent user wouldn't have noticed the reconnects and disconnects happening.

Notice:

  • You with Tixati see two different peers. (a) the destination ip:port:(tcp,udp) are different (b) the peer IDs are different

This line is also occur, but in our issue it is a same IP.

@SeaHOH commented on GitHub (Sep 1, 2023): @arvidn In https://forum.tixati.com/support/7807 , the devs hasn't answered yet for now time. And, an user **notaLamer** commented some views, his English is better than me, please take a look at. > Hello, I believe arvidn misunderstood you there. He thinks you are using qbittorrent. > I think from the screenshots you have shown, it's the duplicated remote qbittorrent peer (the one from China) who terminates the connection. > > The following situation, correct me if wrong and if right please repost on github: > > - You with Tixati see two different peers. (a) the destination ip:port:(tcp,udp) are different (b) the peer IDs are different > - Tixati is CORRECT to assume in both cases that it sees TWO peers. > > - The qbittorrent client may or may not know about the two different IPs it has on the outside. It sees Tixati connecting with (a) same IP:port:protocol (b) same peer ID. > - This remote client is the only one who has the information to conclude the second connection is a duplicate. > - It closes the 2nd connection, but Tixati does NOT know why. It tries again later. > > If correct then Tixati is not at fault other than continuing to try. > > There are two decisions in qbittorrent that lead to this: > 1. Only allowing one connection per IP. This will get worse as IPv4 addresses will become shared between more users. Including VPN users. > 2. Totally randomizing peer ID. > > The reason why you noticed is because Tixati is a unique client in that it keeps recent peers in the list for a long time. Other clients would show them at all. I would bet your qbittorrent user wouldn't have noticed the reconnects and disconnects happening. Notice: > - You with Tixati see two different peers. (a) the destination ip:port:(tcp,udp) are different (b) the peer IDs are different This line is also occur, but in our issue it is a same IP.
Author
Owner

@SeaHOH commented on GitHub (Sep 1, 2023):

I am not good at English, I will use simple words try to rearrange what has happened.

Torrent:

  • Torrent_T

Client A:

  • has two interfaces, IP_A_v4 and IP_A_v6
  • listen to IP_A_v4:Port_A and IP_A_v6:Port_A
  • sent PeerID_A to every connection on Torrent_T

Client B (qBittorrent):

  • has two interfaces, IP_B_v4 and IP_B_v6
  • listen to IP_B_v4:Port_B and IP_B_v6:Port_B
  • sent different PeerIDs to every connection on Torrent_T

Case 1, same interface, different ports:

  1. IP_A_v4:Port_A_out_1 try connect to IP_B_v4:Port_B,
    sent PeerID_A and received PeerID_B_1,
    success connected,
    sent/received some file data of Torrent_T,
    then disconnected by some reasons.
  2. IP_B_v4:Port_B_out_1 try connect to IP_A_v4:Port_A,
    sent PeerID_B_2 and received PeerID_A,
    success connected,
    sent/received some file data of Torrent_T,
    keep connected.
  3. IP_A_v4:Port_A_out_1 try connect to IP_B_v4:Port_B again,
    sent PeerID_A and received PeerID_B_1,
    then disconnected by Client B side.
    Or, success connected,
    then previous connection has been disconnected by Client B side,
    sent/received some file data of Torrent_T,
    keep connected.

Case 2, different interfaces, different ports:

  1. IP_A_v4:Port_A_out_1 try connect to IP_B_v4:Port_B,
    sent PeerID_A and received PeerID_B_1,
    success connected,
    sent/received some file data of Torrent_T,
    keep connected.
  2. IP_A_v6:Port_A_out_2 try connect to IP_B_v6:Port_B,
    sent PeerID_A and received PeerID_B_3,
    then disconnected by Client B side.
    Or, success connected,
    then previous connection has been disconnected by Client B side,
    sent/received some file data of Torrent_T,
    keep connected.
  3. IP_B_v6:Port_B_out_2 try connect to IP_A_v6:Port_A,
    sent PeerID_B_4 and received PeerID_A,
    then disconnected by Client B side.
    Or, success connected,
    then previous connection has been disconnected by Client B side,
    sent/received some file data of Torrent_T,
    keep connected.

What is the conclusion?
Client A has saw 4 different peers, but Client B has saw only 1 peer whatever interfaces be used.

Other cases?
If there is a Client A2 running on the interfaces as same as Client A, what will happen?

@SeaHOH commented on GitHub (Sep 1, 2023): I am not good at English, I will use simple words try to rearrange what has happened. Torrent: - `Torrent_T` Client A: - has two interfaces, `IP_A_v4` and `IP_A_v6` - listen to `IP_A_v4:Port_A` and `IP_A_v6:Port_A` - sent `PeerID_A` to every connection on `Torrent_T` Client B (qBittorrent): - has two interfaces, `IP_B_v4` and `IP_B_v6` - listen to `IP_B_v4:Port_B` and `IP_B_v6:Port_B` - sent different PeerIDs to every connection on `Torrent_T` Case 1, same interface, different ports: 1. `IP_A_v4:Port_A_out_1` try connect to `IP_B_v4:Port_B`, sent `PeerID_A` and received `PeerID_B_1`, success connected, sent/received some file data of `Torrent_T`, then disconnected by some reasons. 1. `IP_B_v4:Port_B_out_1` try connect to `IP_A_v4:Port_A`, sent `PeerID_B_2` and received `PeerID_A`, success connected, sent/received some file data of `Torrent_T`, keep connected. 1. `IP_A_v4:Port_A_out_1` try connect to `IP_B_v4:Port_B` again, sent `PeerID_A` and received `PeerID_B_1`, then disconnected by Client B side. Or, success connected, then previous connection has been disconnected by Client B side, sent/received some file data of `Torrent_T`, keep connected. Case 2, different interfaces, different ports: 1. `IP_A_v4:Port_A_out_1` try connect to `IP_B_v4:Port_B`, sent `PeerID_A` and received `PeerID_B_1`, success connected, sent/received some file data of `Torrent_T`, keep connected. 1. `IP_A_v6:Port_A_out_2` try connect to `IP_B_v6:Port_B`, sent `PeerID_A` and received `PeerID_B_3`, then disconnected by Client B side. Or, success connected, then previous connection has been disconnected by Client B side, sent/received some file data of `Torrent_T`, keep connected. 1. `IP_B_v6:Port_B_out_2` try connect to `IP_A_v6:Port_A`, sent `PeerID_B_4` and received `PeerID_A`, then disconnected by Client B side. Or, success connected, then previous connection has been disconnected by Client B side, sent/received some file data of `Torrent_T`, keep connected. What is the conclusion? Client A has saw 4 different peers, but Client B has saw only 1 peer whatever interfaces be used. Other cases? If there is a Client A2 running on the interfaces as same as Client A, what will happen?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/qBittorrent#14848
No description provided.