qbittorrent / qBittorrent

qBittorrent BitTorrent client
https://www.qbittorrent.org
Other
28.6k stars 4k forks source link

qBittorrent is connecting to itself, and own IP appears in peer list #10791

Open oddstr13 opened 5 years ago

oddstr13 commented 5 years ago

qBittorrent version and Operating System

qBittorrent v4.1.5 OS: Linux (linuxserver.io docker image)

If on linux, libtorrent and Qt version

Not displayed in Web UI. Docker image: Linuxserver.io version:- 4.1.5.99201904170702-6696-4253515ubuntu18.04.1-ls18 Build-date:- 2019-04-17T10:14:08+01:00

What is the problem

Peer list contains two copies of the client (self peer), own peer id not filtered out. qBittorrent is connecting to itself. This means that reported peers will allways be at least 2 (1)

What is the expected behavior

Not listing itself in the peer list, 0 (0) in the peer column and returning 0 in the API calls

Steps to reproduce

It is showing up on every torrent in my qBittorrent.

Extra info(if any)

I'm guessing this may related to DHT, PEX and/or LPD

See also #5663.

Kolcha commented 5 years ago

4.1.6 and master branch also affected, at least on Linux when only DHT is enabled. only public (external) IP appears in peers list, with or without VPN doesn't matter. possibly this must be submitted to libtorrent too

N46AN commented 5 years ago

In my case I see three copy of myself: ::ffff:127.0.0.1 127.0.0.1 [my public ip address]

Also for the second item (127.0.0.1) the port is not the local listening port, but some other port, and it's not listed in resource monitor "Network - Listening" list.

coolio2013 commented 5 years ago

Are you guys on VPN? While connected to VPN, I could see my IP nearly always (it disappeared usually at some time, nand eventually came back, always only max, 1 entry, never 2 or 3). But I'm using WireGuard for 2 month now and could NEVER EVER see my public IP any more (both VPN/WireGuard were/are clients on my router). I never could figure out what caused seeing my own IP in the peer-list when I was on (Open)VPN.

Considering this, it might not be an issue of qbt.

oddstr13 commented 5 years ago

Each peer (client) has a (randomly generated) peer ID. qBittorrent should never attempt to connect when the peer ID matches it's own.

This may very well be a libtorrent issue, but I don't know the codebases enough to know if qBittorrent or libtorrent is the cause of the issue.

And if it is a libtorrent issue, qBittorrent should be able to work around it by filtering away it's own peer ID before presenting the count/peer list to the API. Never mind if it connects to itself in the background or not, but for scripting purposes, having the peer count showing one or more peers when it is just connecting to itself means it's way harder to detect truly dead torrents.

FranciscoPombal commented 5 years ago

Happens to me as well, with no special settings or environment like a using VPN.

@arvidn Thoughts?

My config for reference:

[General]
MainWindowLastDir=/home/user/Downloads

[AddNewTorrentDialog]
DialogSize=@Size(900 620)
RememberLastSavePath=false
SplitterState=@ByteArray(\0\0\0\xff\0\0\0\x1\0\0\0\x2\0\0\x1o\0\0\x1\0\0\xff\xff\xff\xff\x1\0\0\0\x1\0)
expanded=true
qt5\treeHeaderState=<snip>
width=764

[Application]
FileLogger\Age=1
FileLogger\AgeType=1
FileLogger\Backup=true
FileLogger\DeleteOld=false
FileLogger\Enabled=true
FileLogger\MaxSizeBytes=66560
FileLogger\Path=/home/user/.local/share/data/qBittorrent/logs

[AutoRun]
enabled=false
program=

[BitTorrent]
Session\AsyncIOThreadsCount=64
Session\ChokingAlgorithm=FixedSlots
Session\CoalesceReadWrite=true
Session\CreateTorrentSubfolder=true
Session\DisableAutoTMMByDefault=true
Session\DisableAutoTMMTriggers\CategoryChanged=false
Session\DisableAutoTMMTriggers\CategorySavePathChanged=true
Session\DisableAutoTMMTriggers\DefaultSavePathChanged=true
Session\SeedChokingAlgorithm=FastestUpload
Session\SendBufferLowWatermark=3072
Session\SendBufferWatermark=30720
Session\SendBufferWatermarkFactor=125

[CookiesDialog]
CookiesViewState=<snip>
Size=@Size(1391 369)

[Core]
AutoDeleteAddedTorrentFile=Never

[GUI]
DownloadTrackerFavicon=false
Log\Enabled=true
Log\Types=-1
Notifications\DownloadTrackerFavicon=true
Notifications\Enabled=true
Notifications\TorrentAdded=false
RSSWidget\Enabled=true
RSSWidget\OpenedFolders=@Invalid()

[LegalNotice]
Accepted=true

[MainWindow]
geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x2\0\0\0\0\0\x31\0\0\x1o\0\0\a\x7f\0\0\x4\x37\0\0\0\x33\0\0\x1\x88\0\0\a}\0\0\x4\x35\0\0\0\0\0\0\0\0\a\x80)
qt5\vsplitterState=@ByteArray(\0\0\0\xff\0\0\0\x1\0\0\0\x2\0\0\0\xac\0\0\x6\x8b\x1\xff\xff\xff\xff\x1\0\0\0\x1\0)

[Network]
Cookies=<snip>

[Preferences]
Advanced\AnnounceToAllTrackers=true
Advanced\DisableRecursiveDownload=false
Advanced\IncludeOverhead=false
Advanced\RecheckOnCompletion=false
Advanced\TrayIconStyle=0
Advanced\confirmRemoveAllTags=true
Advanced\confirmTorrentDeletion=true
Advanced\confirmTorrentRecheck=true
Advanced\trackerPort=9000
Advanced\useSystemIconTheme=true
Bittorrent\AddTrackers=false
Bittorrent\MaxConnecs=2000
Bittorrent\MaxConnecsPerTorrent=500
Bittorrent\MaxRatioAction=0
Bittorrent\MaxUploads=-1
Bittorrent\MaxUploadsPerTorrent=-1
Bittorrent\PeX=true
Connection\GlobalDLLimitAlt=10
Connection\GlobalUPLimitAlt=10
Connection\InterfaceListenIPv6=true
Connection\InterfaceName=
Connection\MaxHalfOpenConnec=-1
Connection\ResolvePeerCountries=true
Connection\ResolvePeerHostNames=true
Connection\alt_speeds_on=false
Downloads\DblClOnTorDl=1
Downloads\DblClOnTorFn=1
Downloads\DiskWriteCacheSize=-1
Downloads\NewAdditionDialog=true
Downloads\NewAdditionDialogFront=true
Downloads\PreAllocation=false
Downloads\ScanDirsV2=@Variant(\0\0\0\x1c\0\0\0\0)
Downloads\StartInPause=false
Downloads\TorrentExportDir=/home/user/Downloads/torrent_files
Downloads\UseIncompleteExtension=false
DynDNS\DomainName=changeme.dyndns.org
DynDNS\Enabled=false
DynDNS\Password=
DynDNS\Service=0
DynDNS\Username=
General\AlternatingRowColors=true
General\CloseToTray=false
General\ExitConfirm=true
General\HideZeroComboValues=0
General\HideZeroValues=false
General\Locale=en
General\MinimizeToTray=false
General\NoSplashScreen=true
General\PreventFromSuspendWhenDownloading=true
General\PreventFromSuspendWhenSeeding=true
General\SpeedInTitleBar=true
General\StartMinimized=false
General\SystrayEnabled=false
General\UseRandomPort=true
MailNotification\email=
MailNotification\enabled=false
MailNotification\password=
MailNotification\req_auth=false
MailNotification\req_ssl=false
MailNotification\sender=qBittorrent_notification@example.com
MailNotification\smtp_server=smtp.changeme.com
MailNotification\username=
Queueing\QueueingEnabled=false
Scheduler\days=0
Scheduler\end_time=@Variant(\0\0\0\xf\x4J\xa2\0)
Scheduler\start_time=@Variant(\0\0\0\xf\x1\xb7t\0)
Search\SearchEnabled=true
State\hSplitterSizes=123, 628
State\size=@Size(779 591)
WebUI\Address=
WebUI\AlternativeUIEnabled=false
WebUI\AuthSubnetWhitelistEnabled=false
WebUI\CSRFProtection=true
WebUI\ClickjackingProtection=true
WebUI\Enabled=false
WebUI\HTTPS\Enabled=false
WebUI\HostHeaderValidation=true
WebUI\LocalHostAuth=true
WebUI\Password_ha1=<snip>
WebUI\Port=8080
WebUI\RootFolder=
WebUI\ServerDomains=*
WebUI\UseUPnP=false
WebUI\Username=admin

[RSS]
AutoDownloader\DownloadRepacks=true
AutoDownloader\SmartEpisodeFilter=s(\\d+)e(\\d+), (\\d+)x(\\d+), "(\\d{4}[.\\-]\\d{1,2}[.\\-]\\d{1,2})", "(\\d{1,2}[.\\-]\\d{1,2}[.\\-]\\d{4})"

[RssFeedDownloader]
geometrySize=@Size(818 577)
qt5\hsplitterSizes=@ByteArray(\0\0\0\xff\0\0\0\x1\0\0\0\x3\0\0\x1\0\0\0\x1\0\0\0\x1\0\x1\xff\xff\xff\xff\x1\0\0\0\x1\0)

[ShutdownConfirmDlg]
DontConfirmAutoExit=false

[SpeedWidget]
Enabled=true
graph_enable_0=true
graph_enable_1=true
graph_enable_2=true
graph_enable_3=true
graph_enable_4=false
graph_enable_5=false
graph_enable_6=false
graph_enable_7=false
graph_enable_8=false
graph_enable_9=false
period=1

[TorrentAdditionDlg]
save_path_history=/home/user/Downloads

[TorrentCreator]
Comments=
Dimension=@Size(592 690)
IgnoreRatio=false
LastAddPath=
LastSavePath=/home/user/Downloads
OptimizeAlignment=true
PieceSize=0
PrivateTorrent=true
Source=
StartSeeding=false
WebSeedList=

[TorrentProperties]
CurrentTab=0
Peers\qt5\PeerListState=<snip>
SplitterSizes="149,404"
Trackers\qt5\TrackerListState=<snip>
Visible=true
qt5\FilesListState=<snip>

[TransferList]
qt5\HeaderState=<snip>

[TransferListFilters]
selectedFilterIndex=0
Temtaime commented 4 years ago

Same issue here, 4.1.7 nox on linux

arvidn commented 4 years ago

which version of libtorrent is this with?

Dnkhatri commented 4 years ago

which version of libtorrent is this with?

The same used to happen with deluge with 1.13 or 1.2 libtorrent. While downloading it shows my external ip as well as my local network as peers connected. Its the same with qbitorrent 4.19 which uses libtorrent.

zellchristensen commented 3 years ago

I had the same issue, but only temporarily, on Windows 7 x64 with qB v4.3.5. My external IP address would show up as a peer for myself. One thing of note is that my Win7 machine is getting internet from a Linux host that's sharing its wifi connection so maybe there's something relating to linux network routing. I used to share the connection using a Windows host and don't recall the issue happening but I don't remember for sure.

anikey-from-i2p commented 10 months ago

I'm guessing this may related to DHT, PEX and/or LPD

This is also a problem with all of those disabled, when using I2P (mixed mode off).

The peer list lists its own destination. I can also see in i2pd webconsole that it connects to itself. Connecting to itself is discouraged (see this issue comment).

I'm not a developer, but is it not possible to make some check like "if ((peer.ip == my.external_ip && peer.port == my.port) || peer.i2p_dest == my.i2p_dest) then don't connect"? (I'm thinking this should be issue on libtorrent maybe instead, there is some issue like that already)?