Bug 242042

Summary: ktorrent still crashes when used for a few hours at a time
Product: [Applications] ktorrent Reporter: Richard Hartmann <richih-kde>
Component: generalAssignee: Joris Guisson <joris.guisson>
Status: RESOLVED FIXED    
Severity: crash CC: axela74, chriswhy, cwgundlach4, gordey, lashloe, mail, marcos.caceres, mastercactapus, muziofg, niky.el45, vvasaitis, zorael
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian unstable   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: New crash information added by DrKonqi

Description Richard Hartmann 2010-06-18 01:48:28 UTC
Application: ktorrent (4.0.1)
KDE Platform Version: 4.4.4 (KDE 4.4.4)
Qt Version: 4.6.2
Operating System: Linux 2.6.32-5-686 i686
Distribution: Debian GNU/Linux unstable (sid)

-- Information about the crash:
Seems https://bugs.kde.org/show_bug.cgi?id=223243 was not fixed, after all :(

The crash can be reproduced every time.

 -- Backtrace:
Application: KTorrent (ktorrent), signal: Aborted
[Current thread is 1 (Thread 0xb4a62710 (LWP 5926))]

Thread 6 (Thread 0xb2affb70 (LWP 5928)):
#0  0xb5255e16 in *__GI_clock_gettime (clock_id=-1255825420, tp=0xb2aff028) at ../sysdeps/unix/clock_gettime.c:100
#1  0xb68a846b in qt_gettime () at kernel/qcore_unix.cpp:111
#2  0xb68ad675 in QTimerInfoList::updateCurrentTime (this=0x86f472c) at kernel/qeventdispatcher_unix.cpp:340
#3  0xb68ab46e in timerSourceCheckHelper (src=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:150
#4  0xb51c7499 in g_main_context_check () from /lib/libglib-2.0.so.0
#5  0xb51c7dce in ?? () from /lib/libglib-2.0.so.0
#6  0xb51c81b8 in g_main_context_iteration () from /lib/libglib-2.0.so.0
#7  0xb68ab36f in QEventDispatcherGlib::processEvents (this=0x86ab4c8, flags=...) at kernel/qeventdispatcher_glib.cpp:414
#8  0xb687df49 in QEventLoop::processEvents (this=0xb2aff2d0, flags=) at kernel/qeventloop.cpp:149
#9  0xb687e39a in QEventLoop::exec (this=0xb2aff2d0, flags=...) at kernel/qeventloop.cpp:201
#10 0xb677abd8 in QThread::exec (this=0xb2b00ee0) at thread/qthread.cpp:487
#11 0xb7675e7d in utp::UTPServerThread::run() () from /usr/lib/libktorrent.so.1
#12 0xb677d93e in QThreadPrivate::start (arg=0xb2b00ee0) at thread/qthread_unix.cpp:248
#13 0xb529d955 in start_thread (arg=0xb2affb70) at pthread_create.c:300
#14 0xb5aba14e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 5 (Thread 0xb22feb70 (LWP 5929)):
#0  0xb76f9424 in __kernel_vsyscall ()
#1  0xb5ab32d1 in select () at ../sysdeps/unix/syscall-template.S:82
#2  0xb763a005 in ?? () from /usr/lib/libktorrent.so.1
#3  0xb677d93e in QThreadPrivate::start (arg=0x86f90c0) at thread/qthread_unix.cpp:248
#4  0xb529d955 in start_thread (arg=0xb22feb70) at pthread_create.c:300
#5  0xb5aba14e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 4 (Thread 0xadbffb70 (LWP 5952)):
#0  0xb76f9424 in __kernel_vsyscall ()
#1  0xb52a2242 in pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/pthread_cond_timedwait.S:179
#2  0xb5ac7154 in __pthread_cond_timedwait (cond=0xadbff1e8, mutex=0xadbff218, abstime=0xadbff260) at forward.c:152
#3  0xb677d241 in thread_sleep (ti=0x1) at thread/qthread_unix.cpp:398
#4  0xb677d383 in QThread::msleep (msecs=50) at thread/qthread_unix.cpp:424
#5  0xb75d1962 in ?? () from /usr/lib/libktorrent.so.1
#6  0xb75d22d8 in ?? () from /usr/lib/libktorrent.so.1
#7  0xb677d93e in QThreadPrivate::start (arg=0x8601840) at thread/qthread_unix.cpp:248
#8  0xb529d955 in start_thread (arg=0xadbffb70) at pthread_create.c:300
#9  0xb5aba14e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 3 (Thread 0xaeda3b70 (LWP 5953)):
#0  0xb76f9424 in __kernel_vsyscall ()
#1  0xb52a2242 in pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/pthread_cond_timedwait.S:179
#2  0xb5ac7154 in __pthread_cond_timedwait (cond=0xaeda31e8, mutex=0xaeda3218, abstime=0xaeda3260) at forward.c:152
#3  0xb677d241 in thread_sleep (ti=0x1) at thread/qthread_unix.cpp:398
#4  0xb677d383 in QThread::msleep (msecs=50) at thread/qthread_unix.cpp:424
#5  0xb75d0eb2 in ?? () from /usr/lib/libktorrent.so.1
#6  0xb75d22d8 in ?? () from /usr/lib/libktorrent.so.1
#7  0xb677d93e in QThreadPrivate::start (arg=0x8601c48) at thread/qthread_unix.cpp:248
#8  0xb529d955 in start_thread (arg=0xaeda3b70) at pthread_create.c:300
#9  0xb5aba14e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 2 (Thread 0xb346fb70 (LWP 5954)):
#0  0xb76f9424 in __kernel_vsyscall ()
#1  0xb52a1f15 in pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/pthread_cond_wait.S:122
#2  0xb5ac70fd in __pthread_cond_wait (cond=0xb1439888, mutex=0xb1439870) at forward.c:139
#3  0xb677e867 in QWaitConditionPrivate::wait (this=0x9ffa993c, mutex=0x9ffa9938, time=4294967295) at thread/qwaitcondition_unix.cpp:87
#4  QWaitCondition::wait (this=0x9ffa993c, mutex=0x9ffa9938, time=4294967295) at thread/qwaitcondition_unix.cpp:159
#5  0xb75d56da in ?? () from /usr/lib/libktorrent.so.1
#6  0xb677d93e in QThreadPrivate::start (arg=0x9ffa9930) at thread/qthread_unix.cpp:248
#7  0xb529d955 in start_thread (arg=0xb346fb70) at pthread_create.c:300
#8  0xb5aba14e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 1 (Thread 0xb4a62710 (LWP 5926)):
[KCrash Handler]
#6  0xb76f9424 in __kernel_vsyscall ()
#7  0xb5a18751 in *__GI_raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#8  0xb5a1bb82 in *__GI_abort () at abort.c:92
#9  0xb5c384ef in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/libstdc++.so.6
#10 0xb5c36425 in ?? () from /usr/lib/libstdc++.so.6
#11 0xb5c36462 in std::terminate() () from /usr/lib/libstdc++.so.6
#12 0xb5c3651b in __cxa_rethrow () from /usr/lib/libstdc++.so.6
#13 0xb687f942 in QCoreApplication::notifyInternal (this=0xbf8bc1c0, receiver=0x86ac8a4, event=0xbf8bbe70) at kernel/qcoreapplication.cpp:707
#14 0xb68ae986 in QCoreApplication::sendEvent (this=0x8629834) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:215
#15 QTimerInfoList::activateTimers (this=0x8629834) at kernel/qeventdispatcher_unix.cpp:603
#16 0xb68ab677 in timerSourceDispatch (source=0x8629868) at kernel/qeventdispatcher_glib.cpp:184
#17 idleTimerSourceDispatch (source=0x8629868) at kernel/qeventdispatcher_glib.cpp:231
#18 0xb51c42f5 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#19 0xb51c7fd8 in ?? () from /lib/libglib-2.0.so.0
#20 0xb51c81b8 in g_main_context_iteration () from /lib/libglib-2.0.so.0
#21 0xb68ab335 in QEventDispatcherGlib::processEvents (this=0x8600640, flags=...) at kernel/qeventdispatcher_glib.cpp:412
#22 0xb5e85255 in QGuiEventDispatcherGlib::processEvents (this=0x8600640, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#23 0xb687df49 in QEventLoop::processEvents (this=0xbf8bc134, flags=) at kernel/qeventloop.cpp:149
#24 0xb687e39a in QEventLoop::exec (this=0xbf8bc134, flags=...) at kernel/qeventloop.cpp:201
#25 0xb688252f in QCoreApplication::exec () at kernel/qcoreapplication.cpp:981
#26 0xb5dc6c87 in QApplication::exec () at kernel/qapplication.cpp:3579
#27 0x08069231 in _start ()

Possible duplicates by query: bug 241702, bug 241692, bug 241628, bug 241598, bug 241469.

Reported using DrKonqi
Comment 1 Joris Guisson 2010-06-18 16:22:53 UTC
Post the log file from the crash.

It is probably a std::bad_alloc exception, caused by running out of memory.
Comment 2 Richard Hartmann 2010-06-18 16:49:03 UTC
"Log file" as in "start on the shell and look at whatever comes out of STDOUT"?

If not, where can I find the log?
Comment 3 Joris Guisson 2010-06-18 18:07:56 UTC
In ~/.kde/share/apps/ktorrent/ there are files named log-1.gz, log-2.gz ...

These are the log files of the last 10 sessions, there is also a file named log, which is the log file of the current session (or last if KT isn't running)
Comment 4 Richard Hartmann 2010-06-19 11:03:46 UTC
The last second before the crash, log privacy scraped, but consistant. (D keeps on being D, etc)

Sat Jun 19 10:55:39 2010: Authentication to A : failure
Sat Jun 19 10:55:39 2010: Error thrown: Illegal token: 65
Sat Jun 19 10:55:39 2010: Error happened during parsing : Illegal token: 65
Sat Jun 19 10:55:39 2010: Timeout occurred
Sat Jun 19 10:55:39 2010: Authentication to B : failure
Sat Jun 19 10:55:39 2010: Doing scrape request to url : C Sat Jun 19 10:55:39 2010: Accepted connection from [::ffff:D]:60982
Sat Jun 19 10:55:39 2010: DHT: Sending ping response
Sat Jun 19 10:55:39 2010: Error thrown: Illegal token: 17
Sat Jun 19 10:55:39 2010: Error happened during parsing : Illegal token: 17
Sat Jun 19 10:55:39 2010: Authentication(S) to D : failure
Sat Jun 19 10:55:39 2010: Initiating connection to E via (UTP)
Sat Jun 19 10:55:39 2010: Request timed out 3089 49152 16384 Transmission 1.5.1.0
Sat Jun 19 10:55:39 2010: Initiating connection to F via (UTP)
Sat Jun 19 10:55:39 2010: Initiating connection to G via (UTP)
Sat Jun 19 10:55:39 2010: Timeout occurred
Sat Jun 19 10:55:39 2010: Authentication to H : failure
Sat Jun 19 10:55:39 2010: Initiating connection to H via (TCP)
Sat Jun 19 10:55:39 2010: Timeout occurred
Sat Jun 19 10:55:39 2010: Authentication to I : failure
Sat Jun 19 10:55:39 2010: Uncaught exception: std::bad_alloc
Comment 5 Richard Hartmann 2010-06-19 12:58:52 UTC
Sat Jun 19 12:35:57 2010: Uncaught exception: std::bad_alloc

Seem to stay the same.
Comment 6 Joris Guisson 2010-06-19 16:13:42 UTC
How much memory was KT using before the crash ?
Comment 7 Richard Hartmann 2010-06-19 16:41:33 UTC
I honestly don't think total RAM is a problem (though this is i386, not x64):

richih@adamantium ~ % free -m
             total       used       free     shared    buffers     cached
Mem:          3295       3078        216          0          0       2136
-/+ buffers/cache:        942       2353
Swap:         4769          0       4768
richih@adamantium ~ %


I can run ps aux in a loop and redirect the output to a log file if you want.
Comment 8 Joris Guisson 2010-06-21 18:16:27 UTC
*** Bug 242362 has been marked as a duplicate of this bug. ***
Comment 9 Joris Guisson 2010-06-25 18:07:49 UTC
*** Bug 242741 has been marked as a duplicate of this bug. ***
Comment 10 Joris Guisson 2010-06-25 18:07:58 UTC
*** Bug 242613 has been marked as a duplicate of this bug. ***
Comment 11 Nathan Caza 2010-06-25 20:18:27 UTC
Created attachment 48328 [details]
New crash information added by DrKonqi

using ktorrent for a few hours results in crash
Comment 12 Joris Guisson 2010-06-28 17:58:21 UTC
*** Bug 241570 has been marked as a duplicate of this bug. ***
Comment 13 Richard Hartmann 2010-06-28 17:59:39 UTC
Is there any ETA on a fix? This issue makes ktorrent almost useless.
Comment 14 Richard Hartmann 2010-06-28 18:00:36 UTC
Is there any ETA on a fix? This issue makes ktorrent almost useless.
Comment 15 mail 2010-06-28 19:00:16 UTC
Yesterday, I'm add ktorrent in cron for run every 20 minutes. I see crash-message only one.
May be, kernel of ktorrent collect date in background and they call crash, but if you restore ktorrent's window this date reset.
Comment 16 Joris Guisson 2010-06-28 19:04:16 UTC
> Is there any ETA on a fix? This issue makes ktorrent almost useless.

I'm working on it, it's an annoying hard to track down memory leak of some sort, turn of µTP in the mean time.
Comment 17 Richard Hartmann 2010-06-28 19:18:34 UTC
If I can help tracking it down, just tell me :)

Thanks for the hint with uTP; I didn't know that uTP caused this. I will report back if it crashes again.
Comment 18 Joris Guisson 2010-06-29 20:27:07 UTC
I'm fairly certain now what the problem is, will have to come up with a more memory efficient delay window.
Comment 19 Joris Guisson 2010-07-02 18:50:10 UTC
SVN commit 1145357 by guisson:

Fix bug with sequence number wrapping around in µTP causing bad_alloc's

BUG: 242042

 M  +1 -0      ChangeLog  
 M  +13 -4     src/utp/connection.cpp  
 M  +12 -7     src/utp/localwindow.cpp  
 M  +29 -0     src/utp/utpprotocol.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1145357
Comment 20 Joris Guisson 2010-07-07 08:49:58 UTC
*** Bug 243784 has been marked as a duplicate of this bug. ***
Comment 21 Richard Hartmann 2010-07-07 08:56:44 UTC
Are there any plans to release 4.0.2 now that the bug is (hopefully) squashed?

That would reduce your workload due to duplicate bug reports, too :)
Comment 22 Joris Guisson 2010-07-07 14:17:47 UTC
I was planning to tag the release today, and release it today or tomorrow (depends on how much time I have)
Comment 23 Joris Guisson 2010-07-08 17:49:23 UTC
*** Bug 243937 has been marked as a duplicate of this bug. ***
Comment 24 Joris Guisson 2010-07-22 09:12:54 UTC
*** Bug 245392 has been marked as a duplicate of this bug. ***
Comment 25 Joris Guisson 2010-07-27 10:32:51 UTC
*** Bug 245853 has been marked as a duplicate of this bug. ***
Comment 26 Joris Guisson 2010-08-02 18:02:08 UTC
*** Bug 246494 has been marked as a duplicate of this bug. ***
Comment 27 Joris Guisson 2010-08-24 18:34:47 UTC
*** Bug 248868 has been marked as a duplicate of this bug. ***