Bug 274413

Summary: KTorrent crash after Adding trackers
Product: [Applications] ktorrent Reporter: Alexey Shildyakov <ashl1future>
Component: generalAssignee: Joris Guisson <joris.guisson>
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:

Description Alexey Shildyakov 2011-05-29 11:29:41 UTC
Application: ktorrent (4.2dev)
KDE Platform Version: 4.6.3 (4.6.3) (Compiled from sources)
Qt Version: 4.7.3
Operating System: Linux 2.6.38-gentoo-r3 x86_64
Distribution (Platform): Gentoo Packages

-- Information about the crash:
1. I opened Trackers view.
2. Then I'was opening the torrents for the same file (the same torrent but different torrent-files). KTorrent was showing me "Trackers are added" to the torrent. But I don't see any changes - only one tracker presented in Trackers list for the torrent. Do it several times for different torrent-files.
3. I tried to add some trackers manually. Add 2 trackers in Add trackers window, click OK.
4. KTorrent show me window like "This trackers have already presented in trackers list" 5. After I clicked OK, KTorrent crashed.

KTorrent at the commit 9203f06d6fb2fa8ae3b40cde7b9e863370ba4ce4

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

Thread 8 (Thread 0x7fc4b16f4700 (LWP 7429)):
#0  0x00007fc4c2c0bf33 in __poll (fds=<value optimized out>, nfds=<value optimized out>, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:87
#1  0x00007fc4be5772a1 in g_main_context_poll (context=0x1c32160, block=<value optimized out>, dispatch=<value optimized out>, self=<value optimized out>) at gmain.c:3404
#2  g_main_context_iterate (context=0x1c32160, block=<value optimized out>, dispatch=<value optimized out>, self=<value optimized out>) at gmain.c:3086
#3  0x00007fc4be5776de in g_main_context_iteration (context=0x1c32160, may_block=1) at gmain.c:3154
#4  0x00007fc4c4792696 in QEventDispatcherGlib::processEvents (this=0x1d276e0, flags=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:424
#5  0x00007fc4c4762ef2 in QEventLoop::processEvents (this=<value optimized out>, flags=...) at kernel/qeventloop.cpp:149
#6  0x00007fc4c4763174 in QEventLoop::exec (this=0x7fc4b16f3e20, flags=...) at kernel/qeventloop.cpp:201
#7  0x00007fc4c466a4d8 in QThread::exec (this=<value optimized out>) at thread/qthread.cpp:492
#8  0x00007fc4c466d10a in QThreadPrivate::start (arg=0x1d277a0) at thread/qthread_unix.cpp:320
#9  0x00007fc4c43d9c3a in start_thread (arg=<value optimized out>) at pthread_create.c:301
#10 0x00007fc4c2c14d1d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

Thread 7 (Thread 0x7fc4b0ef3700 (LWP 7430)):
#0  0x00007fc4c2c0bf33 in __poll (fds=<value optimized out>, nfds=<value optimized out>, timeout=500) at ../sysdeps/unix/sysv/linux/poll.c:87
#1  0x00007fc4c6b43431 in net::Poll::poll (this=0x7fc4b0ef2d50, timeout=<value optimized out>) at /var/tmp/portage/net-libs/libktorrent-9999/work/libktorrent-9999/src/net/poll.cpp:99
#2  0x00007fc4c6bbb677 in dht::RPCServer::Private::run (this=<value optimized out>) at /var/tmp/portage/net-libs/libktorrent-9999/work/libktorrent-9999/src/dht/rpcserver.cpp:95
#3  0x00007fc4c466d10a in QThreadPrivate::start (arg=0x7fc4ac010f70) at thread/qthread_unix.cpp:320
#4  0x00007fc4c43d9c3a in start_thread (arg=<value optimized out>) at pthread_create.c:301
#5  0x00007fc4c2c14d1d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

Thread 6 (Thread 0x7fc498aeb700 (LWP 7545)):
#0  pthread_cond_timedwait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:216
#1  0x00007fc4c466ce9a in thread_sleep (ti=0x7fc498aeada0) at thread/qthread_unix.cpp:470
#2  0x00007fc4c466cff0 in QThread::msleep (msecs=<value optimized out>) at thread/qthread_unix.cpp:496
#3  0x00007fc4c6b3e5ed in net::DownloadThread::update (this=0x1be06f0) at /var/tmp/portage/net-libs/libktorrent-9999/work/libktorrent-9999/src/net/downloadthread.cpp:91
#4  0x00007fc4c6b3eee9 in net::NetworkThread::run (this=0x1be06f0) at /var/tmp/portage/net-libs/libktorrent-9999/work/libktorrent-9999/src/net/networkthread.cpp:48
#5  0x00007fc4c466d10a in QThreadPrivate::start (arg=0x1be06f0) at thread/qthread_unix.cpp:320
#6  0x00007fc4c43d9c3a in start_thread (arg=<value optimized out>) at pthread_create.c:301
#7  0x00007fc4c2c14d1d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

Thread 5 (Thread 0x7fc4972e8700 (LWP 7546)):
#0  pthread_cond_timedwait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:216
#1  0x00007fc4c466ce9a in thread_sleep (ti=0x7fc4972e7da0) at thread/qthread_unix.cpp:470
#2  0x00007fc4c466cff0 in QThread::msleep (msecs=<value optimized out>) at thread/qthread_unix.cpp:496
#3  0x00007fc4c6b3d4f5 in net::UploadThread::update (this=0x1be0c10) at /var/tmp/portage/net-libs/libktorrent-9999/work/libktorrent-9999/src/net/uploadthread.cpp:89
#4  0x00007fc4c6b3eee9 in net::NetworkThread::run (this=0x1be0c10) at /var/tmp/portage/net-libs/libktorrent-9999/work/libktorrent-9999/src/net/networkthread.cpp:48
#5  0x00007fc4c466d10a in QThreadPrivate::start (arg=0x1be0c10) at thread/qthread_unix.cpp:320
#6  0x00007fc4c43d9c3a in start_thread (arg=<value optimized out>) at pthread_create.c:301
#7  0x00007fc4c2c14d1d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

Thread 4 (Thread 0x7fc4b1ef5700 (LWP 5127)):
#0  pthread_cond_timedwait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:216
#1  0x00007fc4a9e871e1 in metronom_sync_loop (this=0x4ca29f0) at metronom.c:870
#2  0x00007fc4c43d9c3a in start_thread (arg=<value optimized out>) at pthread_create.c:301
#3  0x00007fc4c2c14d1d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

Thread 3 (Thread 0x7fc4a1f54700 (LWP 5128)):
#0  g_main_context_acquire (context=0x57fdfc0) at gmain.c:2519
#1  0x00007fc4be577095 in g_main_context_iterate (context=0x57fdfc0, block=0, dispatch=92266440, self=0x0) at gmain.c:3035
#2  0x00007fc4be5776de in g_main_context_iteration (context=0x57fdfc0, may_block=1) at gmain.c:3154
#3  0x00007fc4c4792696 in QEventDispatcherGlib::processEvents (this=0x4c8a130, flags=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:424
#4  0x00007fc4c4762ef2 in QEventLoop::processEvents (this=<value optimized out>, flags=...) at kernel/qeventloop.cpp:149
#5  0x00007fc4c4763174 in QEventLoop::exec (this=0x7fc4a1f53dc0, flags=...) at kernel/qeventloop.cpp:201
#6  0x00007fc4c466a4d8 in QThread::exec (this=<value optimized out>) at thread/qthread.cpp:492
#7  0x00007fc4aa0e0e30 in Phonon::Xine::XineThread::run (this=0x5b511b0) at /var/tmp/portage/media-sound/phonon-xine-4.4.4/work/phonon-backend-xine-4.4.4/xine/xinethread.cpp:143
#8  0x00007fc4c466d10a in QThreadPrivate::start (arg=0x5b511b0) at thread/qthread_unix.cpp:320
#9  0x00007fc4c43d9c3a in start_thread (arg=<value optimized out>) at pthread_create.c:301
#10 0x00007fc4c2c14d1d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

Thread 2 (Thread 0x7fc4a154e700 (LWP 4000)):
#0  0x00007fc4c2c0bf33 in __poll (fds=<value optimized out>, nfds=<value optimized out>, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:87
#1  0x00007fc4be5772a1 in g_main_context_poll (context=0x991a730, block=<value optimized out>, dispatch=<value optimized out>, self=<value optimized out>) at gmain.c:3404
#2  g_main_context_iterate (context=0x991a730, block=<value optimized out>, dispatch=<value optimized out>, self=<value optimized out>) at gmain.c:3086
#3  0x00007fc4be5776de in g_main_context_iteration (context=0x991a730, may_block=1) at gmain.c:3154
#4  0x00007fc4c4792696 in QEventDispatcherGlib::processEvents (this=0xa26f520, flags=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:424
#5  0x00007fc4c4762ef2 in QEventLoop::processEvents (this=<value optimized out>, flags=...) at kernel/qeventloop.cpp:149
#6  0x00007fc4c4763174 in QEventLoop::exec (this=0x7fc4a154dde0, flags=...) at kernel/qeventloop.cpp:201
#7  0x00007fc4c466a4d8 in QThread::exec (this=<value optimized out>) at thread/qthread.cpp:492
#8  0x00007fc4c4743215 in QInotifyFileSystemWatcherEngine::run (this=0x991a070) at io/qfilesystemwatcher_inotify.cpp:248
#9  0x00007fc4c466d10a in QThreadPrivate::start (arg=0x991a070) at thread/qthread_unix.cpp:320
#10 0x00007fc4c43d9c3a in start_thread (arg=<value optimized out>) at pthread_create.c:301
#11 0x00007fc4c2c14d1d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

Thread 1 (Thread 0x7fc4c7074760 (LWP 7427)):
[KCrash Handler]
#6  0x00007fc4c2b6f675 in raise (sig=<value optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#7  0x00007fc4c2b70a90 in abort () at abort.c:92
#8  0x00007fc4c6b2be80 in bt::QtMessageOutput (type=<value optimized out>, msg=0xb33c2e8 "ASSERT: \"last >= first\" in file kernel/qabstractitemmodel.cpp, line 2392") at /var/tmp/portage/net-libs/libktorrent-9999/work/libktorrent-9999/src/util/log.cpp:308
#9  0x00007fc4c4662336 in qt_message_output (msgType=QtFatalMsg, buf=<value optimized out>) at global/qglobal.cpp:2228
#10 0x00007fc4c46624f9 in qt_message(QtMsgType, const char *, typedef __va_list_tag __va_list_tag *) (msgType=QtFatalMsg, msg=0x7fc4c47ca598 "ASSERT: \"%s\" in file %s, line %d", ap=0x7fff829ec790) at global/qglobal.cpp:2328
#11 0x00007fc4c46626b5 in qFatal (msg=<value optimized out>) at global/qglobal.cpp:2511
#12 0x00007fc4c475ab40 in QAbstractItemModel::beginInsertRows (this=0x4f31c00, parent=..., first=1, last=0) at kernel/qabstractitemmodel.cpp:2392
#13 0x00007fc49c32c10e in kt::TrackerModel::insertRows (this=0x4f31c00, row=1, count=0, parent=<value optimized out>) at /var/tmp/portage/net-p2p/ktorrent-9999/work/ktorrent-9999/plugins/infowidget/trackermodel.cpp:170
#14 0x00007fc49c32c20a in kt::TrackerModel::addTrackers (this=0x4f31c00, tracker_list=<value optimized out>) at /var/tmp/portage/net-p2p/ktorrent-9999/work/ktorrent-9999/plugins/infowidget/trackermodel.cpp:164
#15 0x00007fc49c329655 in kt::TrackerView::addClicked (this=<value optimized out>) at /var/tmp/portage/net-p2p/ktorrent-9999/work/ktorrent-9999/plugins/infowidget/trackerview.cpp:137
#16 0x00007fc49c328f59 in kt::TrackerView::qt_metacall (this=0x4be3490, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x7fff829ecd40) at /var/tmp/portage/net-p2p/ktorrent-9999/work/ktorrent-9999_build/plugins/infowidget/trackerview.moc:88
#17 0x00007fc4c477af7f in QMetaObject::activate (sender=0x4f2fb70, m=<value optimized out>, local_signal_index=<value optimized out>, argv=0x7fff829ecd40) at kernel/qobject.cpp:3278
#18 0x00007fc4c3f1c9b2 in QAbstractButton::clicked (this=<value optimized out>, _t1=false) at .moc/debug-shared/moc_qabstractbutton.cpp:206
#19 0x00007fc4c3c24b90 in QAbstractButtonPrivate::emitClicked (this=0x4f2fea0) at widgets/qabstractbutton.cpp:546
#20 0x00007fc4c3c261c0 in QAbstractButtonPrivate::click (this=0x4f2fea0) at widgets/qabstractbutton.cpp:539
#21 0x00007fc4c3c263ec in QAbstractButton::mouseReleaseEvent (this=0x4f2fb70, e=0x7fff829ed830) at widgets/qabstractbutton.cpp:1121
#22 0x00007fc4c388edf1 in QWidget::event (this=0x4f2fb70, event=0x7fff829ed830) at kernel/qwidget.cpp:8259
#23 0x00007fc4c3835440 in QApplicationPrivate::notify_helper (this=0x1c2f020, receiver=0x4f2fb70, e=0x7fff829ed830) at kernel/qapplication.cpp:4462
#24 0x00007fc4c383b150 in QApplication::notify (this=<value optimized out>, receiver=0x4f2fb70, e=0x7fff829ed830) at kernel/qapplication.cpp:4023
#25 0x000000000043e48c in kt::App::notify (this=0x7fff829ee3a0, receiver=0x4f2fb70, event=0x7fff829ed830) at /var/tmp/portage/net-p2p/ktorrent-9999/work/ktorrent-9999/ktorrent/app.cpp:99
#26 0x00007fc4c476448b in QCoreApplication::notifyInternal (this=0x7fff829ee3a0, receiver=0x4f2fb70, event=0x7fff829ed830) at kernel/qcoreapplication.cpp:731
#27 0x00007fc4c3836848 in sendEvent (receiver=0x4f2fb70, event=0x7fff829ed830, alienWidget=0x4f2fb70, nativeWidget=0x45fbcf0, buttonDown=0x7fc4c43d01f8, lastMouseReceiver=..., spontaneous=true) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:215
#28 QApplicationPrivate::sendMouseEvent (receiver=0x4f2fb70, event=0x7fff829ed830, alienWidget=0x4f2fb70, nativeWidget=0x45fbcf0, buttonDown=0x7fc4c43d01f8, lastMouseReceiver=..., spontaneous=true) at kernel/qapplication.cpp:3122
#29 0x00007fc4c38bfdd0 in QETWidget::translateMouseEvent (this=0x45fbcf0, event=<value optimized out>) at kernel/qapplication_x11.cpp:4461
#30 0x00007fc4c38be459 in QApplication::x11ProcessEvent (this=0x7fff829ee3a0, event=0x7fff829edfe0) at kernel/qapplication_x11.cpp:3587
#31 0x00007fc4c38e6db2 in x11EventSourceDispatch (s=0x1c2ee40, callback=0, user_data=0x0) at kernel/qguieventdispatcher_glib.cpp:146
#32 0x00007fc4be572ff9 in g_main_dispatch (context=0x1c2e300) at gmain.c:2440
#33 g_main_context_dispatch (context=0x1c2e300) at gmain.c:3013
#34 0x00007fc4be577538 in g_main_context_iterate (context=0x1c2e300, block=<value optimized out>, dispatch=<value optimized out>, self=<value optimized out>) at gmain.c:3091
#35 0x00007fc4be5776de in g_main_context_iteration (context=0x1c2e300, may_block=1) at gmain.c:3154
#36 0x00007fc4c479265a in QEventDispatcherGlib::processEvents (this=0x1c2e0d0, flags=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:422
#37 0x00007fc4c38e6a66 in QGuiEventDispatcherGlib::processEvents (this=<value optimized out>, flags=<value optimized out>) at kernel/qguieventdispatcher_glib.cpp:204
#38 0x00007fc4c4762ef2 in QEventLoop::processEvents (this=<value optimized out>, flags=...) at kernel/qeventloop.cpp:149
#39 0x00007fc4c4763174 in QEventLoop::exec (this=0x7fff829ee300, flags=...) at kernel/qeventloop.cpp:201
#40 0x00007fc4c47686db in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1008
#41 0x000000000042d6bb in main (argc=<value optimized out>, argv=<value optimized out>) at /var/tmp/portage/net-p2p/ktorrent-9999/work/ktorrent-9999/ktorrent/main.cpp:177

Reported using DrKonqi
Comment 1 Joris Guisson 2011-05-29 17:23:17 UTC
Git commit d7bd13a8690788763a6753db51bea2ff58b70a0a by Joris Guisson.
Committed on 29/05/2011 at 17:22.
Pushed by guisson into branch 'master'.

Fix crash when duplicate trackers are added

BUG: 274413

M  +3    -0    ChangeLog     
M  +3    -0    plugins/infowidget/trackermodel.cpp     
M  +2    -1    plugins/infowidget/trackerview.cpp     

http://commits.kde.org/ktorrent/d7bd13a8690788763a6753db51bea2ff58b70a0a
Comment 2 Joris Guisson 2011-05-29 17:26:00 UTC
Git commit 28ed7f23897147a350c3223c96814fb6808b1ef0 by Joris Guisson.
Committed on 29/05/2011 at 17:22.
Pushed by guisson into branch '4.1'.

Backport to 4.1: Fix crash when duplicate trackers are added

CCBUG: 274413

M  +3    -0    ChangeLog     
M  +3    -0    plugins/infowidget/trackermodel.cpp     
M  +2    -1    plugins/infowidget/trackerview.cpp     

http://commits.kde.org/ktorrent/28ed7f23897147a350c3223c96814fb6808b1ef0