Bug 490894 - KTorrent persistently writing 2 bytes to a "magnets" file while torrents are active
Summary: KTorrent persistently writing 2 bytes to a "magnets" file while torrents are ...
Status: RESOLVED FIXED
Alias: None
Product: ktorrent
Classification: Applications
Component: general (other bugs)
Version First Reported In: 24.05.2
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Joris Guisson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-27 16:15 UTC by Luke Horwell
Modified: 2025-08-08 23:03 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In: 25.08.1
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luke Horwell 2024-07-27 16:15:50 UTC
SUMMARY

When a torrent is active, i.e. downloading or seeding, a file named "magnets" in ~/.local/share/ktorrent is persistently being written to in a loop. This causes the HDD activity indicator to be constantly flickering on/off.

The content of that file is just 2 bytes: "le". Happens even under a fresh configuration. No magnets are active.

STEPS TO REPRODUCE
1. Start a torrent, such as KDE Neon ISO.

STEPS TO DIAGNOSE
1. Install "inotifywait" package for the distro
2. Run "inotifywait -m -r /home/$USER/.local/share/ktorrent/"

WORKAROUND
Create a symbolic link for "magnets" to "/dev/null".

SOFTWARE/OS VERSIONS
OS: Arch Linux
KDE Plasma Version: 6.1.3
KDE Frameworks Version: 6.4.0
Qt Version: 6.7.2

ADDITIONAL INFORMATION
- Still happens even if all plugins are disabled.
- Deleting the file immediately recreates it.
Comment 1 Luke Horwell 2024-07-27 16:17:02 UTC
Forgot to add the output of inotifywait, if it helps:

```
/home/luke/.local/share/ktorrent/ OPEN magnets
/home/luke/.local/share/ktorrent/ MODIFY magnets
/home/luke/.local/share/ktorrent/ CLOSE_WRITE,CLOSE magnets
```
(repeated multiple times every second)
Comment 2 Bug Janitor Service 2025-06-28 18:11:50 UTC
A possibly relevant merge request was started @ https://invent.kde.org/network/ktorrent/-/merge_requests/153
Comment 3 Jack Hill 2025-08-08 22:56:07 UTC
Git commit 4510509950c10beda3ff7d409efe8f33a71d9ebc by Jack Hill.
Committed on 08/08/2025 at 22:56.
Pushed by jackh into branch 'master'.

Fix issue of constantly writing to the magnets file.

Basically MagnetManager was constantly emitting `update`, even if it
hadn't updated. I've removed the bad emit and added a test to ensure the
signal is only emitted when needed.

M  +5    -0    libktcore/autotests/CMakeLists.txt
A  +220  -0    libktcore/autotests/magnetmanagertest.cpp     [License: GPL(v2.0+)]
M  +0    -2    libktcore/torrent/magnetmanager.cpp

https://invent.kde.org/network/ktorrent/-/commit/4510509950c10beda3ff7d409efe8f33a71d9ebc
Comment 4 Jack Hill 2025-08-08 23:03:13 UTC
Git commit ebeaf20737bd9b02ac703e243ae2b9aef7ed32e0 by Jack Hill.
Committed on 08/08/2025 at 23:03.
Pushed by jackh into branch 'release/25.08'.

Fix issue of constantly writing to the magnets file.

Basically MagnetManager was constantly emitting `update`, even if it
hadn't updated. I've removed the bad emit and added a test to ensure the
signal is only emitted when needed.
FIXED-IN: 25.08.1

(cherry picked from commit 4510509950c10beda3ff7d409efe8f33a71d9ebc)

Co-authored-by: Jack Hill <jackhill3103@gmail.com>

M  +5    -0    libktcore/autotests/CMakeLists.txt
A  +220  -0    libktcore/autotests/magnetmanagertest.cpp     [License: GPL(v2.0+)]
M  +0    -2    libktcore/torrent/magnetmanager.cpp

https://invent.kde.org/network/ktorrent/-/commit/ebeaf20737bd9b02ac703e243ae2b9aef7ed32e0