Bug 299536

Summary: KTorrent crashes every session
Product: [Applications] ktorrent Reporter: David Palacio <dpalacio>
Component: generalAssignee: Joris Guisson <joris.guisson>
Status: RESOLVED FIXED    
Severity: crash CC: fkereki, garrison.al, gwingerde, kdebugs
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian unstable   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: valgrind log

Description David Palacio 2012-05-07 02:53:51 UTC
Application: ktorrent (4.2)
KDE Platform Version: 4.7.4 (4.7.4)
Qt Version: 4.8.1
Operating System: Linux 3.2.0-1-amd64 x86_64
Distribution: Debian GNU/Linux unstable (sid)

-- Information about the crash:
Every KTorrent session crashes after roughly less than 60 minutes running. I have disabled uTP to see if that had anything to do but it made no difference.

The crash can be reproduced every time.

-- Backtrace:
Application: KTorrent (ktorrent), signal: Aborted
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
__lll_lock_wait_private () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:97
[Current thread is 1 (Thread 0x7f38607d5760 (LWP 25402))]

Thread 5 (Thread 0x7f38430c5700 (LWP 25408)):
#0  syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:39
#1  0x00007f385d3ccdfb in _q_futex (val2=0, addr2=0x0, timeout=0x0, val=2, op=0, addr=0x164fe00) at thread/qmutex_unix.cpp:99
#2  QMutexPrivate::wait (this=0x164fe00, timeout=<optimized out>) at thread/qmutex_unix.cpp:113
#3  0x00007f385d3c8bcd in QMutex::lockInternal (this=<optimized out>) at thread/qmutex.cpp:450
#4  0x00007f38602c9c0e in bt::Out (arg=<optimized out>) at ../../src/util/log.cpp:272
#5  0x00007f38602c9f8a in bt::QtMessageOutput (type=<optimized out>, msg=0x7f38380159e8 "QSocketNotifier: Invalid socket 26 and type 'Read', disabling...") at ../../src/util/log.cpp:300
#6  0x00007f385d3c377e in qt_message_output (msgType=QtWarningMsg, buf=0x7f38380159e8 "QSocketNotifier: Invalid socket 26 and type 'Read', disabling...") at global/qglobal.cpp:2203
#7  0x00007f385d3c3c1f in qt_message(QtMsgType, const char *, typedef __va_list_tag __va_list_tag *) (msgType=QtWarningMsg, msg=0x7f385d5a9530 "QSocketNotifier: Invalid socket %d and type '%s', disabling...", ap=0x7f38430c4ba8) at global/qglobal.cpp:2322
#8  0x00007f385d3c43a4 in qWarning (msg=<optimized out>) at global/qglobal.cpp:2404
#9  0x00007f385d4fbe4a in socketNotifierSourceCheck (source=0x29940f0) at kernel/qeventdispatcher_glib.cpp:90
#10 0x00007f3856fb5643 in g_main_context_check () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#11 0x00007f3856fb5ad6 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#12 0x00007f3856fb5c64 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#13 0x00007f385d4fc6cf in QEventDispatcherGlib::processEvents (this=0x2873520, flags=...) at kernel/qeventdispatcher_glib.cpp:424
#14 0x00007f385d4cbf92 in QEventLoop::processEvents (this=<optimized out>, flags=...) at kernel/qeventloop.cpp:149
#15 0x00007f385d4cc1e7 in QEventLoop::exec (this=0x7f38430c4df0, flags=...) at kernel/qeventloop.cpp:204
#16 0x00007f385d3cb307 in QThread::exec (this=<optimized out>) at thread/qthread.cpp:501
#17 0x00007f385d4abd0f in QInotifyFileSystemWatcherEngine::run (this=0x251b180) at io/qfilesystemwatcher_inotify.cpp:248
#18 0x00007f385d3ce32b in QThreadPrivate::start (arg=0x251b180) at thread/qthread_unix.cpp:298
#19 0x00007f3858bf2b50 in start_thread (arg=<optimized out>) at pthread_create.c:304
#20 0x00007f385b9a69dd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#21 0x0000000000000000 in ?? ()

Thread 4 (Thread 0x7f3841dcb700 (LWP 25413)):
#0  __lll_lock_wait_private () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:97
#1  0x00007f385b94a488 in _L_lock_9627 () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x00007f385b948871 in *__GI___libc_free (mem=0x7f385bc50e60) at malloc.c:3736
#3  0x00007f385b969a7d in tzset_internal (always=<optimized out>, explicit=<optimized out>) at tzset.c:435
#4  0x00007f385b969d10 in __tzset () at tzset.c:592
#5  0x00007f385d3dced6 in QDateTime::currentDateTime () at tools/qdatetime.cpp:3139
#6  0x00007f38602c8d84 in finishLine (this=0x161c730) at ../../src/util/log.cpp:132
#7  endline (this=0x161c730) at ../../src/util/log.cpp:161
#8  bt::endl (lg=...) at ../../src/util/log.cpp:224
#9  0x00007f38602dc131 in operator<< (func=<optimized out>, this=<optimized out>) at ../../src/util/log.h:140
#10 net::WakeUpPipe::handleData (this=0x1648690) at ../../src/net/wakeuppipe.cpp:57
#11 0x00007f38602dcd90 in net::Poll::poll (this=0x165c100, timeout=<optimized out>) at ../../src/net/poll.cpp:108
#12 0x00007f38602d9cb9 in net::DownloadThread::waitForSocketReady (this=0x165c0f0) at ../../src/net/downloadthread.cpp:128
#13 0x00007f38602d9dc6 in net::DownloadThread::update (this=0x165c0f0) at ../../src/net/downloadthread.cpp:48
#14 0x00007f38602d9fd9 in net::NetworkThread::run (this=0x165c0f0) at ../../src/net/networkthread.cpp:48
#15 0x00007f385d3ce32b in QThreadPrivate::start (arg=0x165c0f0) at thread/qthread_unix.cpp:298
#16 0x00007f3858bf2b50 in start_thread (arg=<optimized out>) at pthread_create.c:304
#17 0x00007f385b9a69dd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#18 0x0000000000000000 in ?? ()

Thread 3 (Thread 0x7f38415ca700 (LWP 25414)):
[KCrash Handler]
#6  0x00007f385b900475 in *__GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#7  0x00007f385b9036f0 in *__GI_abort () at abort.c:92
#8  0x00007f385b93a2fb in __libc_message (do_abort=<optimized out>, fmt=<optimized out>) at ../sysdeps/unix/sysv/linux/libc_fatal.c:189
#9  0x00007f385b943b46 in malloc_printerr (action=3, str=0x7f385ba1792a "free(): invalid pointer", ptr=<optimized out>) at malloc.c:6283
#10 0x00007f385b94887c in *__GI___libc_free (mem=<optimized out>) at malloc.c:3738
#11 0x00007f38602d59f6 in deallocate (__p=0x2c283d8, this=<optimized out>) at /usr/include/c++/4.6/ext/new_allocator.h:98
#12 _M_put_node (__p=0x2c283d8, this=<optimized out>) at /usr/include/c++/4.6/bits/stl_list.h:331
#13 _M_erase (__position=..., this=<optimized out>) at /usr/include/c++/4.6/bits/stl_list.h:1539
#14 pop_front (this=0x2c283d8) at /usr/include/c++/4.6/bits/stl_list.h:974
#15 net::PacketSocket::write (this=0x2c28390, max=0, now=1336357232177) at ../../src/net/packetsocket.cpp:123
#16 0x00007f38602db033 in net::SocketGroup::processUnlimited (this=0x1650c20, up=true, now=1336357232177) at ../../src/net/socketgroup.cpp:51
#17 0x00007f38602db388 in net::SocketGroup::process (this=0x1650c20, up=<optimized out>, now=<optimized out>, global_allowance=@0x7f38415c9dbc: 0) at ../../src/net/socketgroup.cpp:192
#18 0x00007f38602da5b4 in net::NetworkThread::doGroups (this=0x1652310, num_ready=<optimized out>, now=1336357232177, limit=<optimized out>) at ../../src/net/networkthread.cpp:155
#19 0x00007f38602d98c5 in update (this=0x1652310) at ../../src/net/uploadthread.cpp:81
#20 net::UploadThread::update (this=0x1652310) at ../../src/net/uploadthread.cpp:43
#21 0x00007f38602d9fd9 in net::NetworkThread::run (this=0x1652310) at ../../src/net/networkthread.cpp:48
#22 0x00007f385d3ce32b in QThreadPrivate::start (arg=0x1652310) at thread/qthread_unix.cpp:298
#23 0x00007f3858bf2b50 in start_thread (arg=<optimized out>) at pthread_create.c:304
#24 0x00007f385b9a69dd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#25 0x0000000000000000 in ?? ()

Thread 2 (Thread 0x7f3840dc9700 (LWP 25415)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00007f385d3ce83b in wait (time=18446744073709551615, this=0x2b78b10) at thread/qwaitcondition_unix.cpp:86
#2  QWaitCondition::wait (this=<optimized out>, mutex=0x29468b0, time=18446744073709551615) at thread/qwaitcondition_unix.cpp:158
#3  0x00007f38602dc8aa in net::ReverseResolverThread::run (this=0x29468a0) at ../../src/net/reverseresolver.cpp:124
#4  0x00007f385d3ce32b in QThreadPrivate::start (arg=0x29468a0) at thread/qthread_unix.cpp:298
#5  0x00007f3858bf2b50 in start_thread (arg=<optimized out>) at pthread_create.c:304
#6  0x00007f385b9a69dd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#7  0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7f38607d5760 (LWP 25402)):
#0  __lll_lock_wait_private () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:97
#1  0x00007f385b94a488 in _L_lock_9627 () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x00007f385b948871 in *__GI___libc_free (mem=0x7f385bc50e60) at malloc.c:3736
#3  0x00007f38602e43f7 in deallocate (__p=<optimized out>, this=<optimized out>) at /usr/include/c++/4.6/ext/new_allocator.h:98
#4  _M_put_node (__p=<optimized out>, this=<optimized out>) at /usr/include/c++/4.6/bits/stl_list.h:331
#5  _M_erase (__position=..., this=<optimized out>) at /usr/include/c++/4.6/bits/stl_list.h:1539
#6  erase (__position=..., this=<optimized out>) at /usr/include/c++/4.6/bits/list.tcc:113
#7  bt::AuthenticationMonitor::update (this=0x6dde20) at ../../src/peer/authenticationmonitor.cpp:91
#8  0x000000000042da1f in kt::Core::update (this=0x17a1c00) at ../../ktorrent/core.cpp:1037
#9  0x0000000000435104 in kt::Core::qt_metacall (this=0x17a1c00, _c=QMetaObject::InvokeMetaMethod, _id=10, _a=0x7fff9d781090) at ./core.moc:164
#10 0x00007f385d4e1799 in QMetaObject::activate (sender=0x17a1c28, m=<optimized out>, local_signal_index=<optimized out>, argv=0x0) at kernel/qobject.cpp:3566
#11 0x00007f385d4e6489 in QObject::event (this=0x17a1c28, e=<optimized out>) at kernel/qobject.cpp:1157
#12 0x00007f385c5d1204 in notify_helper (e=0x7fff9d781780, receiver=0x17a1c28, this=0x16869f0) at kernel/qapplication.cpp:4559
#13 QApplicationPrivate::notify_helper (this=0x16869f0, receiver=0x17a1c28, e=0x7fff9d781780) at kernel/qapplication.cpp:4531
#14 0x00007f385c5d6083 in QApplication::notify (this=0x7fff9d781a60, receiver=0x17a1c28, e=0x7fff9d781780) at kernel/qapplication.cpp:4420
#15 0x000000000043b6c1 in kt::App::notify (this=<optimized out>, receiver=<optimized out>, event=<optimized out>) at ../../ktorrent/app.cpp:99
#16 0x00007f385d4cd1ac in QCoreApplication::notifyInternal (this=0x7fff9d781a60, receiver=0x17a1c28, event=0x7fff9d781780) at kernel/qcoreapplication.cpp:876
#17 0x00007f385d4fe4b2 in sendEvent (event=0x7fff9d781780, receiver=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#18 QTimerInfoList::activateTimers (this=0x1677fb0) at kernel/qeventdispatcher_unix.cpp:611
#19 0x00007f385d4fbf1d in timerSourceDispatch (source=<optimized out>) at kernel/qeventdispatcher_glib.cpp:186
#20 timerSourceDispatch (source=<optimized out>) at kernel/qeventdispatcher_glib.cpp:180
#21 0x00007f385d4fbf41 in idleTimerSourceDispatch (source=<optimized out>) at kernel/qeventdispatcher_glib.cpp:233
#22 0x00007f3856fb5853 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#23 0x00007f3856fb5ba0 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#24 0x00007f3856fb5c64 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#25 0x00007f385d4fc6cf in QEventDispatcherGlib::processEvents (this=0x1612c10, flags=...) at kernel/qeventdispatcher_glib.cpp:424
#26 0x00007f385c675aee in QGuiEventDispatcherGlib::processEvents (this=<optimized out>, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#27 0x00007f385d4cbf92 in QEventLoop::processEvents (this=<optimized out>, flags=...) at kernel/qeventloop.cpp:149
#28 0x00007f385d4cc1e7 in QEventLoop::exec (this=0x7fff9d7819f0, flags=...) at kernel/qeventloop.cpp:204
#29 0x00007f385d4d1277 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1148
#30 0x000000000042a1f1 in main (argc=1, argv=0x7fff9d7828d8) at ../../ktorrent/main.cpp:177

Possible duplicates by query: bug 242161.

Reported using DrKonqi
Comment 1 Joris Guisson 2012-05-07 18:54:39 UTC
Would it be possible to run under valgrind until it crashes ?

valgrind --log-file=vg.log /usr/bin/ktorrent --nofork

The log file should be useful in analyzing the problem.
Comment 2 David Palacio 2012-05-10 04:00:39 UTC
Created attachment 70990 [details]
valgrind log

Hi,

I ran it with the provided valgrind command
valgrind --log-file=vg.log /usr/bin/ktorrent --nofork

and it did not crash after 24 hours. I restarted Ktorrent outside valgrind and it crashed again, twice. Another current valgrind run has an uptime of some hours and has not crashed. Is the valgrind log still interesting?

I'll be running /usr/bin/ktorrent --nofork to see if the nofork parameter made the difference in the valgrind run.
Comment 3 Joris Guisson 2012-05-10 17:47:01 UTC
The valgrind log is showing something weird going on which is causing the crash. This should be very helpful.
Comment 4 Joris Guisson 2012-05-10 18:18:32 UTC
Git commit 97095f6a075388f3ca6627315d6f09191847692e by Joris Guisson.
Committed on 10/05/2012 at 20:18.
Pushed by guisson into branch 'master'.

Fix crash due to attempting to call pop_front on an empty list

M  +1    -0    ChangeLog
M  +4    -2    src/net/packetsocket.cpp

http://commits.kde.org/libktorrent/97095f6a075388f3ca6627315d6f09191847692e
Comment 5 Joris Guisson 2012-05-10 18:19:44 UTC
Git commit 04caf8352a053c32fbcc8747cbbb291d5d3efa6a by Joris Guisson.
Committed on 10/05/2012 at 20:18.
Pushed by guisson into branch '1.2'.

Backport to 1.2: Fix crash due to attempting to call pop_front on an empty list

M  +1    -0    ChangeLog
M  +4    -2    src/net/packetsocket.cpp

http://commits.kde.org/libktorrent/04caf8352a053c32fbcc8747cbbb291d5d3efa6a
Comment 6 Joris Guisson 2012-05-10 18:20:28 UTC
*** Bug 299602 has been marked as a duplicate of this bug. ***
Comment 7 Joris Guisson 2012-06-18 09:29:27 UTC
*** Bug 297755 has been marked as a duplicate of this bug. ***
Comment 8 Jekyll Wu 2012-07-19 23:23:23 UTC
*** Bug 303828 has been marked as a duplicate of this bug. ***
Comment 9 Joris Guisson 2012-08-05 08:22:06 UTC
*** Bug 304379 has been marked as a duplicate of this bug. ***
Comment 10 Christoph Feck 2012-08-05 21:51:18 UTC
*** Bug 304635 has been marked as a duplicate of this bug. ***
Comment 11 Christoph Feck 2012-08-10 12:58:15 UTC
*** Bug 304922 has been marked as a duplicate of this bug. ***