mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-03-02 22:57:32 -05:00
High CPU utilization with large HOSTS file #4180
Labels
No labels
Accessibility
AppImage
Bounty
Build system
CI
Can't reproduce
Code cleanup
Confirmed bug
Confirmed bug
Core
Crash
Data loss
Discussion
Docker
Documentation
Duplicate
Feature
Feature request
Feature request
Feature request
Filters
Flatpak
GUI
Has workaround
I2P
Invalid
Libtorrent
Look and feel
Meta
NSIS
Network
Not an issue
OS: *BSD
OS: Linux
OS: Windows
OS: macOS
PPA
Performance
Project management
Proxy/VPN
Qt bugs
Qt6 compat
RSS
Search engine
Security
Temp folder
Themes
Translations
Triggers
Waiting diagnosis
Waiting info
Waiting upstream
Waiting web implementation
Watched folders
WebAPI
WebUI
autoCloseOldIssue
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/qBittorrent#4180
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @B16EC302BEFB051D45025E3342E81C on GitHub (Apr 15, 2016).
Setup: Win7 64bit / qB 3.3.4 (QT 5.6.0, libtorrent 1.0.8.0, boost 1.60.0)
DNS Cache service disabled.
the hosts file is ~ 12MB; it has lots of entries for malware,tracking,etc.
i noticed high CPU utilization when either:
a) torrents are started
b) torrents are stopped
there are 97 torrents. 92 are seeding.
high CPU util will go on for a while, and then settle down. i've seen it last for 10min.
another problem is that when exiting qB, it'll hang (no UI, but qbittorrent.exe process present) until this thread is finished.
i looked at it with sysinternals:procmon and noticed that it's continually reading the HOSTS file. i also noticed that the HOSTS file is locked, alas cannot be renamed.
i then used sysinternals:procexp. i noticed that one thread has high CPU utilization: 25% of quad-core system. picture below.
thread stack dump is below:
next i paused all torrents; exited the program, and ran it again; still with the 12MB HOSTS file. waited a few seconds and then started the torrents. the snapshot below is of the performance graph after about 7 minutes:
the blue I/O graph is the sum of all read activity. peak around 52MB.
next i disabled "Resolve peer host names". paused. exit. reran qB. restart torrents. no change in performance/behavior:
next i paused all torrents then exited qB. renamed the 12MB HOSTS file, and used a much smaller 2KB HOSTS file instead. (note: this can not be done while qB is running since it locks the HOSTS file). the problem is resolved. no high CPU util, and no frantic reading of the HOSTS file.
i toggled between the 12MB and 2KB HOSTS file 3 times. each attempt was similar. pictures below are from each attempt with the 2KB HOSTS file.
Attempt #1:

Attempt #2:

Attempt #3:

note that the I/O in the 3rd attempt peaked at 3.8MB.
workaround: this is not entirely qB related, but it does work for those that wish to use a large HOSTS file. it speeds up the DNS queries as well. i prefer it over the windows DNS cache.
@B16EC302BEFB051D45025E3342E81C commented on GitHub (Apr 16, 2016):
probably same as (or related to) #5097
@ngosang commented on GitHub (Sep 16, 2018):
We are closing all issues related to old qBittorrent versions (qBittorrent < 4.1.0).
Please, update to last release and, if the bug/error/crash is still present, open another issue.
Thank you.