You are not logged in.

#1 2018-07-01 17:01:57

avi9526
Member
Registered: 2015-05-15
Posts: 116

ktorrent unstanble on gigabit connection with lots of peers

ktorrent 5.1.0 start lagging (12309?) when download speed reach 90MiBytes/s if number of peers is > 20. If peers is >50 it often crashes. I can limit peers, but it limit speed (not everybody has good speed)

Anyone have this problem or have ideas how to investigate?

Offline

#2 2018-07-01 19:22:48

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,410

Re: ktorrent unstanble on gigabit connection with lots of peers

Terminal output? Core dumps, stack traces?

Offline

#3 2018-07-01 21:00:53

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,866

Re: ktorrent unstanble on gigabit connection with lots of peers

cabled or wifi connection ?

What router/modem does manage your wan connection ?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#4 2018-07-03 20:38:22

avi9526
Member
Registered: 2015-05-15
Posts: 116

Re: ktorrent unstanble on gigabit connection with lots of peers

Wired through Zyxel Keenetic Viva
speedtest.net show stable >900Mbit/s download and upload

trace generated by KDE crash reporter, it say that this report probably useless

Application: KTorrent (ktorrent), signal: Aborted
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[Current thread is 1 (Thread 0x7fe785c815c0 (LWP 3140))]

Thread 5 (Thread 0x7fe751f57700 (LWP 3157)):
#0  0x00007fe77fd25d50 in pthread_self () from /usr/lib/libc.so.6
#1  0x00007fe7809d67e0 in ?? () from /usr/lib/libQt5Core.so.5
#2  0x00007fe7854c2a6a in ?? () from /usr/lib/libKF5Torrent.so.6
#3  0x00007fe7854c8a92 in ?? () from /usr/lib/libKF5Torrent.so.6
#4  0x00007fe7854c8b66 in ?? () from /usr/lib/libKF5Torrent.so.6
#5  0x00007fe7854c9449 in ?? () from /usr/lib/libKF5Torrent.so.6
#6  0x00007fe7809e3b45 in ?? () from /usr/lib/libQt5Core.so.5
#7  0x00007fe77b77f075 in start_thread () from /usr/lib/libpthread.so.0
#8  0x00007fe77fd1853f in clone () from /usr/lib/libc.so.6

Thread 4 (Thread 0x7fe766de7700 (LWP 3156)):
#0  0x00007fe77fd130f9 in syscall () from /usr/lib/libc.so.6
#1  0x00007fe7809d6536 in QBasicMutex::lockInternal() () from /usr/lib/libQt5Core.so.5
#2  0x00007fe7809d6844 in ?? () from /usr/lib/libQt5Core.so.5
#3  0x00007fe7854c922e in ?? () from /usr/lib/libKF5Torrent.so.6
#4  0x00007fe7854c9449 in ?? () from /usr/lib/libKF5Torrent.so.6
#5  0x00007fe7809e3b45 in ?? () from /usr/lib/libQt5Core.so.5
#6  0x00007fe77b77f075 in start_thread () from /usr/lib/libpthread.so.0
#7  0x00007fe77fd1853f in clone () from /usr/lib/libc.so.6

Thread 3 (Thread 0x7fe7665e6700 (LWP 3144)):
#0  0x00007fe77fd196f6 in recv () from /usr/lib/libc.so.6
#1  0x00007fe783503b21 in ?? () from /usr/lib/libQt5Network.so.5
#2  0x00007fe7834f44a4 in ?? () from /usr/lib/libQt5Network.so.5
#3  0x00007fe7834f4d7d in QNetworkInterface::allInterfaces() () from /usr/lib/libQt5Network.so.5
#4  0x00007fe76599859b in ?? () from /usr/lib/qt/plugins/bearer/libqgenericbearer.so
#5  0x00007fe780ba084d in QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const () from /usr/lib/libQt5Core.so.5
#6  0x00007fe780ba2109 in QMetaObject::invokeMethod(QObject*, char const*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) () from /usr/lib/libQt5Core.so.5
#7  0x00007fe7834df677 in QNetworkConfigurationManagerPrivate::performAsyncConfigurationUpdate() () from /usr/lib/libQt5Network.so.5
#8  0x00007fe7834df8b4 in QNetworkConfigurationManagerPrivate::startPolling() () from /usr/lib/libQt5Network.so.5
#9  0x00007fe7834dfcb3 in QNetworkConfigurationManagerPrivate::updateConfigurations() () from /usr/lib/libQt5Network.so.5
#10 0x00007fe78356afce in ?? () from /usr/lib/libQt5Network.so.5
#11 0x00007fe780bbc3d2 in QObject::event(QEvent*) () from /usr/lib/libQt5Core.so.5
#12 0x00007fe780b91c97 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5
#13 0x00007fe780b94d4c in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/libQt5Core.so.5
#14 0x00007fe780be5a54 in ?? () from /usr/lib/libQt5Core.so.5
#15 0x00007fe778e2c368 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#16 0x00007fe778e2c5b1 in ?? () from /usr/lib/libglib-2.0.so.0
#17 0x00007fe778e2c63e in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#18 0x00007fe780be5039 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#19 0x00007fe780b9094c in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#20 0x00007fe7809d9a99 in QThread::exec() () from /usr/lib/libQt5Core.so.5
#21 0x00007fe7809e3b45 in ?? () from /usr/lib/libQt5Core.so.5
#22 0x00007fe77b77f075 in start_thread () from /usr/lib/libpthread.so.0
#23 0x00007fe77fd1853f in clone () from /usr/lib/libc.so.6

Thread 2 (Thread 0x7fe767fff700 (LWP 3142)):
#0  0x00007fe77fd0dea9 in poll () from /usr/lib/libc.so.6
#1  0x00007fe778e2c523 in ?? () from /usr/lib/libglib-2.0.so.0
#2  0x00007fe778e2c63e in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#3  0x00007fe780be5054 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#4  0x00007fe780b9094c in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#5  0x00007fe7809d9a99 in QThread::exec() () from /usr/lib/libQt5Core.so.5
#6  0x00007fe782034976 in ?? () from /usr/lib/libQt5DBus.so.5
#7  0x00007fe7809e3b45 in ?? () from /usr/lib/libQt5Core.so.5
#8  0x00007fe77b77f075 in start_thread () from /usr/lib/libpthread.so.0
#9  0x00007fe77fd1853f in clone () from /usr/lib/libc.so.6

Thread 1 (Thread 0x7fe785c815c0 (LWP 3140)):
[KCrash Handler]
#6  0x00007fe77fc5686b in raise () from /usr/lib/libc.so.6
#7  0x00007fe77fc4140e in abort () from /usr/lib/libc.so.6
#8  0x00007fe78061944a in __gnu_cxx::__verbose_terminate_handler () at /build/gcc/src/gcc/libstdc++-v3/libsupc++/vterminate.cc:95
#9  0x00007fe78061f9d6 in __cxxabiv1::__terminate(void (*)()) () at /build/gcc/src/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:47
#10 0x00007fe78061e9fa in __cxa_call_terminate (ue_header=ue_header@entry=0x5634f9927150) at /build/gcc/src/gcc/libstdc++-v3/libsupc++/eh_call.cc:54
#11 0x00007fe78061f3d1 in __gxx_personality_v0 () at /build/gcc/src/gcc/libstdc++-v3/libsupc++/eh_personality.cc:676
#12 0x00007fe77fff0373 in _Unwind_RaiseException_Phase2 () at /build/gcc/src/gcc/libgcc/unwind.inc:64
#13 0x00007fe77fff0bf5 in _Unwind_Resume () at /build/gcc/src/gcc/libgcc/unwind.inc:241
#14 0x00007fe78550b5f5 in bt::Downloader::saveWebSeeds(QString const&) () from /usr/lib/libKF5Torrent.so.6
#15 0x00007fe78552e2eb in bt::TorrentControl::~TorrentControl() () from /usr/lib/libKF5Torrent.so.6
#16 0x00007fe78552e66a in bt::TorrentControl::~TorrentControl() () from /usr/lib/libKF5Torrent.so.6
#17 0x00007fe78588985f in kt::QueueManager::~QueueManager() () from /usr/lib/libktcore.so.16
#18 0x00007fe7858898ca in kt::QueueManager::~QueueManager() () from /usr/lib/libktcore.so.16
#19 0x00005634f4933bce in ?? ()
#20 0x00005634f4933fe9 in ?? ()
#21 0x00005634f493e0f2 in ?? ()
#22 0x00005634f492319a in ?? ()
#23 0x00007fe77fc4306b in __libc_start_main () from /usr/lib/libc.so.6
#24 0x00005634f492f89a in _start ()

Console output huge, but at the end it has something interesting

<date>: mmap failed : Cannot allocate memory
<date>: mmap failed : Cannot allocate memory
<date>: mmap failed : Cannot allocate memory
…
<date>: Qt Warning: Qt has caught an exception thrown from an event handler. Throwing
exceptions from an event handler is not supported in Qt.
You must not let any exception whatsoever propagate through Qt code.
If that is not possible, in Qt 5 you must at least reimplement
QCoreApplication::notify() and catch all exceptions there.
sock_file=/run/user/1000/kdeinit5__0

it is weird since I was monitoring ktorrent in systemmonitor and none of it's memory consumption (Virt. size, Memory, Shared Mem) didn't go close to 16GB (RAM available)

Totals

Private	1084868 KB	(= 914236 KB clean + 170632 KB dirty)
Shared	439316 KB	(= 439300 KB clean + 16 KB dirty)
Rss	1524184 KB	(= Private + Shared)
Pss	1277212 KB	(= Private + Shared/Number of Processes)
Swap	0 KB

Full details in systemmonitor is long. Maybe ktorrent run out of some other limits (descriptors, etc)?

Tried

PID=$(pidof ktorrent)
while kill -0 $PID
do
	echo "$(date +%s%3N);$(cat /proc/$PID/maps | wc -l)" | tee -a /tmp/ktorrent.txt
	sleep 0.5
done

get
https://0x0.st/spEO.png
it crashed after reaching 65k

Mod Edit - Replaced oversized image with link.
CoC - Pasting pictures and code

Last edited by Slithery (2018-07-03 20:40:38)

Offline

#5 2018-07-03 21:01:45

avi9526
Member
Registered: 2015-05-15
Posts: 116

Re: ktorrent unstanble on gigabit connection with lots of peers

After

sudo sysctl -w vm.max_map_count=200000

it stopped crashing (at least for now)
and mmap count graph
https://0x0.st/spEg.png

this is fine for now, yet I not sure if it's okay for ktorrent to mmap so much files

PS
https://bugs.kde.org/show_bug.cgi?id=396142

Last edited by avi9526 (2018-07-03 21:46:15)

Offline

#6 2018-07-04 11:05:02

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,866

Re: ktorrent unstanble on gigabit connection with lots of peers

It does look like mmap is involved, but just to be sure it's not a router memory problem
(more connections means larger routing tables) :


reset mmap count and powercycle the router, then test again.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#7 2018-07-04 11:17:47

avi9526
Member
Registered: 2015-05-15
Posts: 116

Re: ktorrent unstanble on gigabit connection with lots of peers

from router web interface

Keenetic Viva
System monitor
…
Receiving	909.8 Mbps
…
CPU usage	1%
Memory usage	23% (30/128 MB)

seems it is not related, considering that problem is gone (at least it looks so) after rising map limit

Offline

Board footer

Powered by FluxBB