I added a Magnet link to KTorrent (no other torrents were on the list) and after it connected with a couple of peers and started downloaing (the Magnet; it was before KTorrent asked for file location) it froze. I left it, but after a couple of minutes I noticed heavy swapping; it turned out KTorrent process was consuming some 13 GiB of memory. UI was still unresponsive. So I attached gdb to the proccess, grabbed backtrace and killed it. (gdb) bt #0 syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38 #1 0x00007f7def698c63 in _q_futex (val2=0, addr2=0x0, timeout=0x0, val=2, op=0, addr=0x2570790) at thread/qmutex_unix.cpp:99 #2 QMutexPrivate::wait (this=this@entry=0x2570790, timeout=timeout@entry=-1) at thread/qmutex_unix.cpp:113 #3 0x00007f7def694e0d in QMutex::lock (this=this@entry=0x2774580) at thread/qmutex.cpp:164 #4 0x00007f7df2ae2d98 in lockInline (this=0x2774580) at /usr/include/qt4/QtCore/qmutex.h:188 #5 QMutexLocker (m=0x2774580, this=<synthetic pointer>) at /usr/include/qt4/QtCore/qmutex.h:109 #6 net::PacketSocket::addPacket (this=0x2774550, packet=...) at /var/tmp/portage/net-libs/libktorrent-1.3.1/work/libktorrent-1.3.1/src/net/packetsocket.cpp:149 #7 0x00007f7df2afc274 in bt::Peer::sendExtProtMsg (this=0x266cd40, id=<optimized out>, data=...) at /var/tmp/portage/net-libs/libktorrent-1.3.1/work/libktorrent-1.3.1/src/peer/peer.cpp:920 #8 0x00007f7df2b07405 in bt::PeerProtocolExtension::sendPacket (this=<optimized out>, data=...) at /var/tmp/portage/net-libs/libktorrent-1.3.1/work/libktorrent-1.3.1/src/peer/peerprotocolextension.cpp:39 #9 0x00007f7df2b86175 in bt::MetadataDownload::download (this=this@entry=0x27731a0, piece=piece@entry=122254) at /var/tmp/portage/net-libs/libktorrent-1.3.1/work/libktorrent-1.3.1/src/magnet/metadatadownload.cpp:92 #10 0x00007f7df2b86345 in bt::MetadataDownload::downloadNext (this=this@entry=0x27731a0) at /var/tmp/portage/net-libs/libktorrent-1.3.1/work/libktorrent-1.3.1/src/magnet/metadatadownload.cpp:99 #11 0x00007f7df2b86419 in bt::MetadataDownload::reject (this=0x27731a0, piece=695) at /var/tmp/portage/net-libs/libktorrent-1.3.1/work/libktorrent-1.3.1/src/magnet/metadatadownload.cpp:47 #12 0x00007f7df2b08959 in bt::UTMetaData::reject (this=this@entry=0x2765d10, dict=dict@entry=0x24d6c30) at /var/tmp/portage/net-libs/libktorrent-1.3.1/work/libktorrent-1.3.1/src/peer/utmetadata.cpp:97 #13 0x00007f7df2b0916b in bt::UTMetaData::handlePacket (this=0x2765d10, packet=<optimized out>, size=<optimized out>) at /var/tmp/portage/net-libs/libktorrent-1.3.1/work/libktorrent-1.3.1/src/peer/utmetadata.cpp:72 #14 0x00007f7df2afdb5c in bt::Peer::handleExtendedPacket (this=0x266cd40, packet=0x7f7d6c076ae0 "\024\002d8:msg_typei2e5:piecei695e10:total_sizei124919ee", size=50) at /var/tmp/portage/net-libs/libktorrent-1.3.1/work/libktorrent-1.3.1/src/peer/peer.cpp:439 #15 0x00007f7df2b069d5 in bt::PacketReader::update (this=0x26661e0, peer=...) at /var/tmp/portage/net-libs/libktorrent-1.3.1/work/libktorrent-1.3.1/src/peer/packetreader.cpp:70 #16 0x00007f7df2afaa23 in bt::Peer::update (this=0x266cd40) at /var/tmp/portage/net-libs/libktorrent-1.3.1/work/libktorrent-1.3.1/src/peer/peer.cpp:592 #17 0x00007f7df2b02267 in bt::PeerManager::Private::update (this=0x2533600) at /var/tmp/portage/net-libs/libktorrent-1.3.1/work/libktorrent-1.3.1/src/peer/peermanager.cpp:644 #18 0x00007f7df2b0232e in bt::PeerManager::update (this=<optimized out>) at /var/tmp/portage/net-libs/libktorrent-1.3.1/work/libktorrent-1.3.1/src/peer/peermanager.cpp:140 #19 0x00007f7df2b830f3 in bt::MagnetDownloader::update (this=<optimized out>) at /var/tmp/portage/net-libs/libktorrent-1.3.1/work/libktorrent-1.3.1/src/magnet/magnetdownloader.cpp:119 #20 0x000000000044da36 in kt::MagnetModel::updateMagnetDownloaders (this=0x1aff340) at /var/tmp/portage/net-p2p/ktorrent-4.3.1-r1/work/ktorrent-4.3.1/ktorrent/tools/magnetmodel.cpp:84 #21 0x000000000042cc06 in kt::Core::update (this=0x1afd5a0) at /var/tmp/portage/net-p2p/ktorrent-4.3.1-r1/work/ktorrent-4.3.1/ktorrent/core.cpp:1075 #22 0x0000000000434ba5 in kt::Core::qt_static_metacall (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>) at /var/tmp/portage/net-p2p/ktorrent-4.3.1-r1/work/ktorrent-4.3.1_build/ktorrent/core.moc:142 #23 0x00007f7def7c5a05 in QMetaObject::activate (sender=0x1afd5c8, m=<optimized out>, local_signal_index=<optimized out>, argv=0x0) at kernel/qobject.cpp:3547 #24 0x00007f7def7ca559 in QObject::event (this=0x1afd5c8, e=<optimized out>) at kernel/qobject.cpp:1156 #25 0x00007f7defce9f53 in QApplicationPrivate::notify_helper (this=this@entry=0x1947040, receiver=receiver@entry=0x1afd5c8, e=e@entry=0x7fff4650cc20) at kernel/qapplication.cpp:4562 #26 0x00007f7defcf1371 in QApplication::notify (this=0x7fff4650dbc0, receiver=0x1afd5c8, e=0x7fff4650cc20) at kernel/qapplication.cpp:4348 #27 0x000000000043b347 in kt::App::notify (this=<optimized out>, receiver=<optimized out>, event=<optimized out>) at /var/tmp/portage/net-p2p/ktorrent-4.3.1-r1/work/ktorrent-4.3.1/ktorrent/app.cpp:99 #28 0x00007f7def7af46d in QCoreApplication::notifyInternal (this=0x7fff4650dbc0, receiver=0x1afd5c8, event=event@entry=0x7fff4650cc20) at kernel/qcoreapplication.cpp:949 #29 0x00007f7def7e4062 in sendEvent (event=0x7fff4650cc20, receiver=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231 #30 QTimerInfoList::activateTimers (this=0x1946ed0) at kernel/qeventdispatcher_unix.cpp:621 #31 0x00007f7def7e0939 in timerSourceDispatch (source=<optimized out>) at kernel/qeventdispatcher_glib.cpp:186 #32 idleTimerSourceDispatch (source=source@entry=0x19457d0) at kernel/qeventdispatcher_glib.cpp:233 #33 0x00007f7de9f67e31 in g_main_dispatch (context=0x1947380) at /var/tmp/portage/dev-libs/glib-2.38.2-r1/work/glib-2.38.2/glib/gmain.c:3066 #34 g_main_context_dispatch (context=context@entry=0x1947380) at /var/tmp/portage/dev-libs/glib-2.38.2-r1/work/glib-2.38.2/glib/gmain.c:3642 #35 0x00007f7de9f681a8 in g_main_context_iterate (context=context@entry=0x1947380, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at /var/tmp/portage/dev-libs/glib-2.38.2-r1/work/glib-2.38.2/glib/gmain.c:3713 #36 0x00007f7de9f6824f in g_main_context_iteration (context=0x1947380, may_block=1) at /var/tmp/portage/dev-libs/glib-2.38.2-r1/work/glib-2.38.2/glib/gmain.c:3774 #37 0x00007f7def7e0b4a in QEventDispatcherGlib::processEvents (this=0x18fab30, flags=...) at kernel/qeventdispatcher_glib.cpp:425 #38 0x00007f7defd9a20d in QGuiEventDispatcherGlib::processEvents (this=<optimized out>, flags=...) at kernel/qguieventdispatcher_glib.cpp:204 #39 0x00007f7def7ad705 in QEventLoop::processEvents (this=this@entry=0x7fff4650cec0, flags=...) at kernel/qeventloop.cpp:149 #40 0x00007f7def7ad9b5 in QEventLoop::exec (this=this@entry=0x7fff4650cec0, flags=...) at kernel/qeventloop.cpp:204 #41 0x00007f7def7b3dd0 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1221 #42 0x00007f7defce8429 in QApplication::exec () at kernel/qapplication.cpp:3823 #43 0x0000000000428692 in main (argc=2, argv=0x7fff4650dd08) at /var/tmp/portage/net-p2p/ktorrent-4.3.1-r1/work/ktorrent-4.3.1/ktorrent/main.cpp:186 Reproducible: Couldn't Reproduce If it might be relevant, it happened not long after I added my whole home directory to the baloo ignore list; baloo_file_cleaner was actively running at the time of the incident.
On second thought, probably I should have grabbed backtraces of all threads and do it maybe a couple of times... It was definitely doing something (i.e., it was certainly not only a deadlock on that mutex on top of backtrace), as the memory usage was growing all the time and it was consuming one processor thread at about 100%.
Very similar behaviour of Ktorrent for me. Except without memleak. 100% CPU load on 1 core, no response or window redraw from application nor tray-icon. On one particular magnet link with 100% "success". magnet link makin KTorrent unresponsive: magnet:?xt=urn:btih:dc69436982f5fa838f4152a8f266e02b1b8d00c4&dn=BBC+Storyville+2014+The+Lance+Armstrong+Story+Stop+at+Nothing+PD&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80&tr=udp%3A%2F%2Ftracker.istole.it%3A6969&tr=udp%3A%2F%2Fopen.demonii.com%3A1337 log: Fri Aug 1 23:39:28 2014: Cannot create socket : Address family not supported by protocol Fri Aug 1 23:39:28 2014: Failed to set the reuseaddr option : Bad file descriptor Fri Aug 1 23:39:28 2014: Cannot bind to port :::6881 : Bad file descriptor Fri Aug 1 23:39:28 2014: Bound to 0.0.0.0 Fri Aug 1 23:39:28 2014: Bound to TCP port 6881 Fri Aug 1 23:39:28 2014: DHT: Starting on port 7881 Fri Aug 1 23:39:28 2014: Cannot create socket : Address family not supported by protocol Fri Aug 1 23:39:28 2014: Failed to set the reuseaddr option : Bad file descriptor Fri Aug 1 23:39:28 2014: Cannot bind to port :::7881 : Bad file descriptor Fri Aug 1 23:39:28 2014: DHT: Failed to bind to :: Fri Aug 1 23:39:28 2014: Bound to 0.0.0.0 Fri Aug 1 23:39:28 2014: DHT: Bound to 0.0.0.0 Fri Aug 1 23:39:28 2014: Cannot open /home/semo/.kde4/share/apps/ktorrent/groups : No such file or directory Fri Aug 1 23:39:28 2014: Qt Debug: ktorrent(24798)/kdecore (KPluginInfo) KPluginInfo::kcmServices: found 0 offers for "BandwidthSchedulerPlugin" Fri Aug 1 23:39:28 2014: Qt Debug: ktorrent(24798)/kdecore (KPluginInfo) KPluginInfo::kcmServices: found 0 offers for "ShutdownPlugin" Fri Aug 1 23:39:28 2014: Qt Debug: ktorrent(24798)/kdecore (KPluginInfo) KPluginInfo::kcmServices: found 0 offers for "ZeroconfPlugin" Fri Aug 1 23:39:28 2014: Qt Debug: ktorrent(24798)/kdecore (KPluginInfo) KPluginInfo::kcmServices: found 0 offers for "IPFilterPlugin" Fri Aug 1 23:39:28 2014: Qt Debug: ktorrent(24798)/kdecore (KPluginInfo) KPluginInfo::kcmServices: found 0 offers for "StatsPlugin" Fri Aug 1 23:39:28 2014: Qt Debug: ktorrent(24798)/kdecore (KPluginInfo) KPluginInfo::kcmServices: found 0 offers for "LogViewerPlugin" Fri Aug 1 23:39:28 2014: Qt Debug: ktorrent(24798)/kdecore (KPluginInfo) KPluginInfo::kcmServices: found 0 offers for "MagnetGeneratorPlugin" Fri Aug 1 23:39:28 2014: Qt Debug: ktorrent(24798)/kdecore (KPluginInfo) KPluginInfo::kcmServices: found 0 offers for "DownloadOrderPlugin" Fri Aug 1 23:39:28 2014: Qt Debug: ktorrent(24798)/kdecore (KPluginInfo) KPluginInfo::kcmServices: found 0 offers for "MediaPlayerPlugin" Fri Aug 1 23:39:28 2014: Qt Debug: ktorrent(24798)/kdecore (KPluginInfo) KPluginInfo::kcmServices: found 0 offers for "ScanFolderPlugin" Fri Aug 1 23:39:28 2014: Qt Debug: ktorrent(24798)/kdecore (KPluginInfo) KPluginInfo::kcmServices: found 0 offers for "InfoWidgetPlugin" Fri Aug 1 23:39:28 2014: Qt Debug: ktorrent(24798)/kdecore (KPluginInfo) KPluginInfo::kcmServices: found 0 offers for "ScriptingPlugin" Fri Aug 1 23:39:28 2014: Qt Debug: ktorrent(24798)/kdecore (KPluginInfo) KPluginInfo::kcmServices: found 0 offers for "SearchPlugin" Fri Aug 1 23:39:28 2014: Qt Debug: ktorrent(24798)/kdecore (KPluginInfo) KPluginInfo::kcmServices: found 0 offers for "UPnPPlugin" Fri Aug 1 23:39:28 2014: Qt Debug: ktorrent(24798)/kdecore (KLibrary) kde4Factory: The library "/usr/lib64/kde4/ktinfowidgetplugin.so" does not offer a qt_plugin_instance function. Fri Aug 1 23:39:29 2014: Started update timer Fri Aug 1 23:39:29 2014: Failed to suppress sleeping Fri Aug 1 23:39:29 2014: Cannot create socket : Address family not supported by protocol Fri Aug 1 23:39:29 2014: Failed to set the reuseaddr option : Bad file descriptor Fri Aug 1 23:39:29 2014: Cannot bind to port :::8881 : Bad file descriptor Fri Aug 1 23:39:29 2014: Bound to 0.0.0.0 Fri Aug 1 23:39:29 2014: Doing tracker request to url : udp://tracker.openbittorrent.com:80 Fri Aug 1 23:39:29 2014: Doing tracker request to url : udp://tracker.publicbt.com:80 Fri Aug 1 23:39:29 2014: Doing tracker request to url : udp://tracker.istole.it:6969 Fri Aug 1 23:39:29 2014: Doing tracker request to url : udp://open.demonii.com:1337 Fri Aug 1 23:39:29 2014: DHT: Doing announce Fri Aug 1 23:39:29 2014: DHT: finding node Fri Aug 1 23:39:29 2014: Initiating connection to 2.49.106.30 via (TCP) Fri Aug 1 23:39:29 2014: Initiating connection to 2.98.191.208 via (TCP) Fri Aug 1 23:39:29 2014: Initiating connection to 14.202.194.227 via (TCP) Fri Aug 1 23:39:29 2014: Initiating connection to 37.14.147.110 via (TCP) Fri Aug 1 23:39:29 2014: Initiating connection to 46.7.175.226 via (TCP) Fri Aug 1 23:39:29 2014: Initiating connection to 46.24.100.85 via (TCP) Fri Aug 1 23:39:29 2014: Initiating connection to 50.243.224.178 via (TCP) Fri Aug 1 23:39:29 2014: Initiating connection to 58.110.43.66 via (TCP) Fri Aug 1 23:39:29 2014: Initiating connection to 58.164.229.182 via (TCP) Fri Aug 1 23:39:29 2014: Initiating connection to 58.175.44.175 via (TCP) Fri Aug 1 23:39:29 2014: Initiating connection to 62.162.178.147 via (TCP) Fri Aug 1 23:39:29 2014: Initiating connection to 72.71.138.36 via (TCP) Fri Aug 1 23:39:29 2014: Initiating connection to 78.19.0.40 via (TCP) Fri Aug 1 23:39:29 2014: Initiating connection to 78.70.124.237 via (TCP) Fri Aug 1 23:39:29 2014: Initiating connection to 79.150.236.175 via (TCP) Fri Aug 1 23:39:29 2014: Initiating connection to 80.39.206.117 via (TCP) Fri Aug 1 23:39:29 2014: Initiating connection to 80.56.177.248 via (TCP) Fri Aug 1 23:39:29 2014: Initiating connection to 80.57.152.70 via (TCP) Fri Aug 1 23:39:29 2014: Initiating connection to 80.101.101.163 via (TCP) Fri Aug 1 23:39:29 2014: Initiating connection to 80.111.170.46 via (TCP) Fri Aug 1 23:39:29 2014: Initiating connection to 80.167.161.20 via (TCP) Fri Aug 1 23:39:29 2014: Authentication to 37.14.147.110 : failure Fri Aug 1 23:39:29 2014: Initiating connection to 37.14.147.110 via (TCP) Fri Aug 1 23:39:29 2014: Authentication to 79.150.236.175 : failure Fri Aug 1 23:39:29 2014: Initiating connection to 79.150.236.175 via (TCP) Fri Aug 1 23:39:29 2014: Accepted connection from 184.144.75.221 Fri Aug 1 23:39:29 2014: Authentication to 37.14.147.110 : failure Fri Aug 1 23:39:29 2014: Initiating connection to 2.49.106.30 via (TCP) Fri Aug 1 23:39:30 2014: Authentication to 78.70.124.237 : ok Fri Aug 1 23:39:30 2014: Starting socketmonitor threads Fri Aug 1 23:39:30 2014: Authentication to 80.167.161.20 : ok Fri Aug 1 23:39:30 2014: Authentication(S) to 184.144.75.221 : ok Fri Aug 1 23:39:30 2014: Metadata download, requesting 0 Fri Aug 1 23:39:30 2014: Metadata download, requesting 0 Fri Aug 1 23:39:30 2014: Initiating connection to 2.98.191.208 via (TCP) Fri Aug 1 23:39:30 2014: Initiating connection to 14.202.194.227 via (TCP) Fri Aug 1 23:39:30 2014: Authentication to 46.24.100.85 : failure Fri Aug 1 23:39:30 2014: Initiating connection to 46.24.100.85 via (TCP) Fri Aug 1 23:39:30 2014: Authentication to 46.24.100.85 : failure Fri Aug 1 23:39:30 2014: Initiating connection to 27.32.143.82 via (TCP) Fri Aug 1 23:39:31 2014: Metadata download, dowloaded 0 Fri Aug 1 23:39:31 2014: Metadata download, requesting 1 Fri Aug 1 23:39:31 2014: Metadata download, requesting 2 Fri Aug 1 23:39:31 2014: Metadata download, requesting 3 Fri Aug 1 23:39:31 2014: Metadata download, requesting 4 Fri Aug 1 23:39:31 2014: Metadata download, requesting 5 Fri Aug 1 23:39:31 2014: Metadata download, requesting 6 Fri Aug 1 23:39:31 2014: Metadata download, requesting 7 Fri Aug 1 23:39:31 2014: Metadata download, requesting 8 Fri Aug 1 23:39:31 2014: Metadata download, requesting 9 Fri Aug 1 23:39:31 2014: Metadata download, requesting 10 Fri Aug 1 23:39:31 2014: Metadata download, requesting 11 ... etc ... Fri Aug 1 23:39:40 2014: Metadata download, requesting 64455 ... etc etc
please try with KTorrent for KF5
I was able to reproduce it and find a solution. I am using Arch Linux, Ktorrent version 5.0.1-2, KDE Frameworks 5.23.0, Qt 5.6.1. The problem was with the "Magnet Generator" plugin not enabled, which is the default value. I suggest the following fixes to KTorrent: 1) Rename Magnet Generator to Magnet Support, since the current name is misleading. As it seems this plugin is needed for downloading magnets. 2) Enable the Magnet plugin by default, since Magnets are currently popular 3) Check before downloading a Magnet if the plugin is enabled, if not either enable it silently or display a message to user to enable it. If still disabled don't attempt to download. I am not familiar with KTorrent's code base, however if the previous suggested fixes are correct, and no one have the time to fix it, I can dig into the code and submit a patch.
thank you for your insight!
The "Magner Generator" solution doesn't work. It still crashes with many Magnet URIs I've had to REISUB my system three time in the last hour alone because of this. It's a terrible bug because it's sneaky. It doesn't raise the CPU, so unlike Baloo there's no fan whirring up to indicate something is consuming the clock. This is only caught when the RAM runs out, and then everything needs to move to swap to make more room... then it's too late and the PC doesn't respond to anything. I'd go as far as saying this could kill the HDD. KTorrent 5.02, KF 5.25, Qt 5.7. First time this ever happens
Dear Bug Submitter, This bug has been stagnant for a long time. Could you help us out and re-test if the bug is valid in the latest version? I am setting the status to NEEDSINFO pending your response, please change the Status back to REPORTED when you respond. Thank you for helping us make KDE software even better for everyone!
Dear Bug Submitter, This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information as soon as possible and set the bug status as REPORTED. Due to regular bug tracker maintenance, if the bug is still in NEEDSINFO status with no change in 30 days the bug will be closed as RESOLVED > WORKSFORME due to lack of needed information. For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging If you have already provided the requested information, please mark the bug as REPORTED so that the KDE team knows that the bug is ready to be confirmed. Thank you for helping us make KDE software even better for everyone!
This bug has been in NEEDSINFO status with no change for at least 30 days. The bug is now closed as RESOLVED > WORKSFORME due to lack of needed information. For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging Thank you for helping us make KDE software even better for everyone!