Bug 282451

Summary: ktorrent-dev (latest) crash while prompting and ctrl-q entered
Product: [Applications] ktorrent Reporter: George R. Goffe <grgoffe>
Component: generalAssignee: Joris Guisson <joris.guisson>
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: flat ascii file; valgrind log.

Description George R. Goffe 2011-09-21 05:10:03 UTC
Application: ktorrent (4.2dev)
KDE Platform Version: 4.6.5 (4.6.5)
Qt Version: 4.7.4
Operating System: Linux 2.6.35.14-97.fc14.i686 i686
Distribution: "Fedora release 14 (Laughlin)"

-- Information about the crash:
I had just build ktorrent and had started it. I had paused previous downloads and had added more torrents. The count of active and total torrents seems to have disappeared from the UI. Multiple popup prompts stating "torrent is already being downloaded, clients are merged". I got tired of hitting enter so in between prompts I hit ctrl-q and got this crash.

The crash can be reproduced every time.

-- Backtrace:
Application: KTorrent (ktorrent), signal: Segmentation fault
[Current thread is 1 (Thread 0xb76aa780 (LWP 16235))]

Thread 5 (Thread 0xb4bffb70 (LWP 16237)):
#0  0x004bf6ff in __pthread_mutex_unlock_usercnt (mutex=0xb42004ec) at pthread_mutex_unlock.c:52
#1  __pthread_mutex_unlock (mutex=0xb42004ec) at pthread_mutex_unlock.c:290
#2  0x006d56a4 in g_main_context_prepare (context=<value optimized out>, priority=0xb4bff10c) at gmain.c:2467
#3  0x006d655b in g_main_context_iterate (context=0xb42004e8, block=1, dispatch=1, self=<value optimized out>) at gmain.c:2760
#4  0x006d6c35 in g_main_context_iteration (context=0xb42004e8, may_block=1) at gmain.c:2843
#5  0x0745dc07 in QEventDispatcherGlib::processEvents (this=0xb4200468, flags=...) at kernel/qeventdispatcher_glib.cpp:424
#6  0x0742efca in QEventLoop::processEvents (this=0xb4bff260, flags=...) at kernel/qeventloop.cpp:149
#7  0x0742f27a in QEventLoop::exec (this=0xb4bff260, flags=...) at kernel/qeventloop.cpp:201
#8  0x07335ab3 in QThread::exec (this=0x846e350) at thread/qthread.cpp:498
#9  0x00b6dc0d in utp::UTPServerThread::run (this=0x846e350) at /tools/ktorrent/libktorrent/src/utp/utpserverthread.cpp:41
#10 0x07338603 in QThreadPrivate::start (arg=0x846e350) at thread/qthread_unix.cpp:331
#11 0x004bbe99 in start_thread (arg=0xb4bffb70) at pthread_create.c:301
#12 0x003ced2e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:133

Thread 4 (Thread 0xb55b9b70 (LWP 16387)):
#0  0x004bdf7b in __pthread_mutex_lock (mutex=0xb4c004ec) at pthread_mutex_lock.c:61
#1  0x006d56eb in g_main_context_prepare (context=<value optimized out>, priority=0xb55b910c) at gmain.c:2471
#2  0x006d655b in g_main_context_iterate (context=0xb4c004e8, block=1, dispatch=1, self=<value optimized out>) at gmain.c:2760
#3  0x006d6c35 in g_main_context_iteration (context=0xb4c004e8, may_block=1) at gmain.c:2843
#4  0x0745dc07 in QEventDispatcherGlib::processEvents (this=0xb4c00468, flags=...) at kernel/qeventdispatcher_glib.cpp:424
#5  0x0742efca in QEventLoop::processEvents (this=0xb55b9260, flags=...) at kernel/qeventloop.cpp:149
#6  0x0742f27a in QEventLoop::exec (this=0xb55b9260, flags=...) at kernel/qeventloop.cpp:201
#7  0x07335ab3 in QThread::exec (this=0x1ec15440) at thread/qthread.cpp:498
#8  0x02ea1b5a in kt::ScanThread::run (this=0x1ec15440) at /tools/ktorrent/ktorrent/plugins/scanfolder/scanthread.cpp:151
#9  0x07338603 in QThreadPrivate::start (arg=0x1ec15440) at thread/qthread_unix.cpp:331
#10 0x004bbe99 in start_thread (arg=0xb55b9b70) at pthread_create.c:301
#11 0x003ced2e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:133

Thread 3 (Thread 0xa8ba3b70 (LWP 16388)):
#0  0x008a4416 in __kernel_vsyscall ()
#1  0x004c039b in pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S:169
#2  0x4201d1d7 in scavengerThread (context=0x425c9380) at wtf/FastMalloc.cpp:2378
#3  WTF::TCMalloc_PageHeap::runScavengerThread (context=0x425c9380) at wtf/FastMalloc.cpp:1497
#4  0x004bbe99 in start_thread (arg=0xa8ba3b70) at pthread_create.c:301
#5  0x003ced2e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:133

Thread 2 (Thread 0xa80ffb70 (LWP 16389)):
#0  0x0050ce56 in clock_gettime (clock_id=1, tp=0xa80fefd0) at ../sysdeps/unix/clock_gettime.c:100
#1  0x0738fc29 in do_gettime () at tools/qelapsedtimer_unix.cpp:123
#2  qt_gettime () at tools/qelapsedtimer_unix.cpp:140
#3  0x0745e836 in QTimerInfoList::updateCurrentTime (this=0xa7701a74) at kernel/qeventdispatcher_unix.cpp:339
#4  0x0745e26e in timerSourceCheckHelper (src=0xa7701a40) at kernel/qeventdispatcher_glib.cpp:150
#5  0x006d5e07 in g_main_context_check (context=0xa77004e8, max_priority=2147483647, fds=0xa7701b68, n_fds=1) at gmain.c:2658
#6  0x006d6742 in g_main_context_iterate (context=0xa77004e8, block=1, dispatch=1, self=<value optimized out>) at gmain.c:2777
#7  0x006d6c35 in g_main_context_iteration (context=0xa77004e8, may_block=1) at gmain.c:2843
#8  0x0745dc07 in QEventDispatcherGlib::processEvents (this=0xa7700468, flags=...) at kernel/qeventdispatcher_glib.cpp:424
#9  0x0742efca in QEventLoop::processEvents (this=0xa80ff260, flags=...) at kernel/qeventloop.cpp:149
#10 0x0742f27a in QEventLoop::exec (this=0xa80ff260, flags=...) at kernel/qeventloop.cpp:201
#11 0x07335ab3 in QThread::exec (this=0x85f76f0) at thread/qthread.cpp:498
#12 0x07335b4e in QThread::run (this=0x85f76f0) at thread/qthread.cpp:565
#13 0x07338603 in QThreadPrivate::start (arg=0x85f76f0) at thread/qthread_unix.cpp:331
#14 0x004bbe99 in start_thread (arg=0xa80ffb70) at pthread_create.c:301
#15 0x003ced2e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:133

Thread 1 (Thread 0xb76aa780 (LWP 16235)):
[KCrash Handler]
#7  0x00b2d8d3 in qDeleteAll<QList<dht::Task*>::const_iterator> (this=0x83f40a0, __in_chrg=<value optimized out>) at /usr/include/QtCore/qalgorithms.h:322
#8  qDeleteAll<QList<dht::Task*> > (this=0x83f40a0, __in_chrg=<value optimized out>) at /usr/include/QtCore/qalgorithms.h:330
#9  dht::TaskManager::~TaskManager (this=0x83f40a0, __in_chrg=<value optimized out>) at /tools/ktorrent/libktorrent/src/dht/taskmanager.cpp:38
#10 0x00b2d9a2 in dht::TaskManager::~TaskManager (this=0x83f40a0, __in_chrg=<value optimized out>) at /tools/ktorrent/libktorrent/src/dht/taskmanager.cpp:40
#11 0x00b2232c in dht::DHT::stop (this=0x84c5be0) at /tools/ktorrent/libktorrent/src/dht/dht.cpp:99
#12 0x0806c3d6 in kt::Core::onExit (this=0x84d7700) at /tools/ktorrent/ktorrent/ktorrent/core.cpp:906
#13 0x08076351 in kt::GUI::queryExit (this=0x84ba290) at /tools/ktorrent/ktorrent/ktorrent/gui.cpp:564
#14 0x05a5a8b7 in KMainWindowPrivate::_k_shuttingDown (this=0x84ba328) at /usr/src/debug/kdelibs-4.6.5/kdeui/widgets/kmainwindow.cpp:1142
#15 0x05a5d7ee in KMainWindow::qt_metacall (this=0x84ba290, _c=QMetaObject::InvokeMetaMethod, _id=7, _a=0xbfb030bc) at /usr/src/debug/kdelibs-4.6.5/i686-redhat-linux-gnu/kdeui/kmainwindow.moc:102
#16 0x05a9de5b in KXmlGuiWindow::qt_metacall (this=0x84ba290, _c=QMetaObject::InvokeMetaMethod, _id=38, _a=0xbfb030bc) at /usr/src/debug/kdelibs-4.6.5/i686-redhat-linux-gnu/kdeui/kxmlguiwindow.moc:102
#17 0x0788bfbb in KParts::MainWindow::qt_metacall (this=0x84ba290, _c=QMetaObject::InvokeMetaMethod, _id=38, _a=0xbfb030bc) at /usr/src/debug/kdelibs-4.6.5/i686-redhat-linux-gnu/kparts/mainwindow.moc:75
#18 0x080788ef in kt::GUI::qt_metacall (this=0x84ba290, _c=QMetaObject::InvokeMetaMethod, _id=38, _a=0xbfb030bc) at /tools/ktorrent/ktorrent/build/ktorrent/gui.moc:102
#19 0x0743666b in QMetaObject::metacall (object=0x84ba290, cl=QMetaObject::InvokeMetaMethod, idx=38, argv=0xbfb030bc) at kernel/qmetaobject.cpp:237
#20 0x07445c67 in QMetaObject::activate (sender=0xbfb031b0, m=0x756c9c4, local_signal_index=0, argv=0x0) at kernel/qobject.cpp:3278
#21 0x07493d08 in QCoreApplication::aboutToQuit (this=0xbfb031b0) at .moc/release-shared/moc_qcoreapplication.cpp:131
#22 0x07433e4e in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1069
#23 0x02146c98 in QApplication::exec () at kernel/qapplication.cpp:3755
#24 0x08068991 in main (argc=112, argv=0x10) at /tools/ktorrent/ktorrent/ktorrent/main.cpp:177

Reported using DrKonqi
Comment 1 George R. Goffe 2011-09-22 03:02:10 UTC
Created attachment 63835 [details]
flat ascii file; valgrind log.

I had ktorrent-dev (latest) under valgrind up to the point that valgrind ran out of memory (system has 3gb, x86 architecture).
Comment 2 George R. Goffe 2011-09-22 03:04:59 UTC
Joris,

These messages came out of ktorrent during/just before the crash.

Warning: QSocketNotifier: Invalid socket 20 and type 'Read', disabling...
Warning: QSocketNotifier: Invalid socket 441 and type 'Read', disabling...
Warning: QSocketNotifier: Invalid socket 442 and type 'Read', disabling...
Comment 3 Joris Guisson 2011-09-22 17:21:58 UTC
Git commit 88651a66da58ca7fa2f64fb9f224ac250f149c00 by Joris Guisson.
Committed on 22/09/2011 at 19:20.
Pushed by guisson into branch 'master'.

Fix crash in dht::TaskManager and reformat source of several dht classes

BUG: 282451

M  +39   -30   src/dht/announcetask.cpp
M  +16   -8    src/dht/announcetask.h
M  +115  -115  src/dht/dht.cpp
M  +83   -80   src/dht/kbucket.cpp
M  +67   -67   src/dht/node.cpp
M  +4    -2    src/dht/nodelookup.cpp
M  +1    -1    src/dht/nodelookup.h
M  +13   -13   src/dht/rpccall.cpp
M  +18   -18   src/dht/rpccall.h
M  +28   -23   src/dht/task.cpp
M  +32   -29   src/dht/task.h
M  +4    -6    src/dht/taskmanager.cpp

http://commits.kde.org/libktorrent/88651a66da58ca7fa2f64fb9f224ac250f149c00