I suspended the system last night this morning choqok crashed, I have it (choqok) set to update every 15 mins it crashed around 15 mins after the restart. I'm using pfoo's 2013-06-17 build of the deb package. Here's the traceback: Application: Choqok (choqok), signal: Segmentation fault Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1". [Current thread is 1 (Thread 0xb49ed980 (LWP 13107))] Thread 2 (Thread 0xaf894b40 (LWP 13111)): #0 0xb774f424 in __kernel_vsyscall () #1 0xb60138e2 in clock_gettime (clock_id=1, tp=0xaf893f68) at ../sysdeps/unix/clock_gettime.c:115 #2 0xb62720d5 in do_gettime (frac=0xaf893f60, sec=0xaf893f58) at tools/qelapsedtimer_unix.cpp:123 #3 qt_gettime () at tools/qelapsedtimer_unix.cpp:140 #4 0xb635980e in QTimerInfoList::updateCurrentTime (this=this@entry=0xaef02074) at kernel/qeventdispatcher_unix.cpp:354 #5 0xb6359b9a in QTimerInfoList::timerWait (this=0xaef02074, tm=...) at kernel/qeventdispatcher_unix.cpp:461 #6 0xb6358373 in timerSourcePrepareHelper (src=<optimized out>, timeout=0xaf89408c) at kernel/qeventdispatcher_glib.cpp:136 #7 0xb635840d in timerSourcePrepare (source=0xaef02040, timeout=0xaf89408c) at kernel/qeventdispatcher_glib.cpp:169 #8 0xb55b8d21 in g_main_context_prepare () from /lib/i386-linux-gnu/libglib-2.0.so.0 #9 0xb55b95cf in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0 #10 0xb55b9831 in g_main_context_iteration () from /lib/i386-linux-gnu/libglib-2.0.so.0 #11 0xb6358c3f in QEventDispatcherGlib::processEvents (this=0xaef00468, flags=...) at kernel/qeventdispatcher_glib.cpp:426 #12 0xb63253ec in QEventLoop::processEvents (this=this@entry=0xaf894228, flags=...) at kernel/qeventloop.cpp:149 #13 0xb63256e1 in QEventLoop::exec (this=this@entry=0xaf894228, flags=...) at kernel/qeventloop.cpp:204 #14 0xb6210fec in QThread::exec (this=this@entry=0xd058ed0) at thread/qthread.cpp:542 #15 0xb6304f2d in QInotifyFileSystemWatcherEngine::run (this=0xd058ed0) at io/qfilesystemwatcher_inotify.cpp:256 #16 0xb6213b18 in QThreadPrivate::start (arg=0xd058ed0) at thread/qthread_unix.cpp:338 #17 0xb5692d78 in start_thread (arg=0xaf894b40) at pthread_create.c:311 #18 0xb60003de in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:131 Thread 1 (Thread 0xb49ed980 (LWP 13107)): [KCrash Handler] #7 0xb621f7c4 in QDate::isValid (this=0x4d) at tools/qdatetime.cpp:330 #8 0xb6223647 in QDateTime::isValid (this=0x16728674) at tools/qdatetime.cpp:2225 #9 0xb72b260e in Choqok::UI::PostWidget::formatDateTime(QDateTime const&) () from /usr/lib/libchoqok.so.1 #10 0xb72b1dc0 in Choqok::UI::PostWidget::updateUi() () from /usr/lib/libchoqok.so.1 #11 0xb72b5897 in ?? () from /usr/lib/libchoqok.so.1 #12 0xb633cb56 in QMetaObject::activate (sender=sender@entry=0x168e0490, m=m@entry=0xb64914b8 <QTimer::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x0) at kernel/qobject.cpp:3539 #13 0xb638fee5 in QTimer::timeout (this=this@entry=0x168e0490) at .moc/release-shared/moc_qtimer.cpp:148 #14 0xb6346126 in QTimer::timerEvent (this=0x168e0490, e=0xbfa116f0) at kernel/qtimer.cpp:280 #15 0xb63422d4 in QObject::event (this=0x168e0490, e=0xbfa116f0) at kernel/qobject.cpp:1156 #16 0xb6899c7c in QApplicationPrivate::notify_helper (this=0x9e23918, receiver=0x168e0490, e=0xbfa116f0) at kernel/qapplication.cpp:4567 #17 0xb689cb94 in QApplication::notify (this=0xbfa116f0, receiver=0x168e0490, e=0xbfa116f0) at kernel/qapplication.cpp:3949 #18 0xb74d5d01 in KApplication::notify (this=0xbfa11a48, receiver=0x168e0490, event=0xbfa116f0) at ../../kdeui/kernel/kapplication.cpp:311 #19 0xb632690e in QCoreApplication::notifyInternal (this=0xbfa11a48, receiver=0x168e0490, event=event@entry=0xbfa116f0) at kernel/qcoreapplication.cpp:946 #20 0xb635b8c0 in sendEvent (event=0xbfa116f0, receiver=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231 #21 QTimerInfoList::activateTimers (this=this@entry=0x9e234fc) at kernel/qeventdispatcher_unix.cpp:622 #22 0xb63585a8 in timerSourceDispatch (source=0x9e234c8) at kernel/qeventdispatcher_glib.cpp:186 #23 timerSourceDispatch (source=0x9e234c8) at kernel/qeventdispatcher_glib.cpp:180 #24 0xb63585e2 in idleTimerSourceDispatch (source=0x9e23530) at kernel/qeventdispatcher_glib.cpp:233 #25 0xb55b93b3 in g_main_context_dispatch () from /lib/i386-linux-gnu/libglib-2.0.so.0 #26 0xb55b9750 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0 #27 0xb55b9831 in g_main_context_iteration () from /lib/i386-linux-gnu/libglib-2.0.so.0 #28 0xb6358c21 in QEventDispatcherGlib::processEvents (this=this@entry=0x9db9cf8, flags=...) at kernel/qeventdispatcher_glib.cpp:424 #29 0xb6950a5a in QGuiEventDispatcherGlib::processEvents (this=0x9db9cf8, flags=...) at kernel/qguieventdispatcher_glib.cpp:204 #30 0xb63253ec in QEventLoop::processEvents (this=this@entry=0xbfa11978, flags=...) at kernel/qeventloop.cpp:149 #31 0xb63256e1 in QEventLoop::exec (this=this@entry=0xbfa11978, flags=...) at kernel/qeventloop.cpp:204 #32 0xb632b3fa in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1218 #33 0xb6897fc4 in QApplication::exec () at kernel/qapplication.cpp:3828 #34 0x0804f8cd in ?? () #35 0xb5f28935 in __libc_start_main (main=0x804f0c0, argc=1, ubp_av=0xbfa11b24, init=0x8055d10 <__libc_csu_init>, fini=0x8055d80 <__libc_csu_fini>, rtld_fini=0xb775f600 <_dl_fini>, stack_end=0xbfa11b1c) at libc-start.c:260 #36 0x0804f911 in _start () Reproducible: Didn't try
I've just got a crash with the identical traceback but without having done a suspend
*** Bug 321648 has been marked as a duplicate of this bug. ***
Daniel, Could you please take a look at this bug!? :)
I've caught choqok doing this with gdb attached and fumbled around in GDB to examine the state of things. Assuming that I am doing GDB right and looking in the right way, d->mCurrentPost in Choqok::UI::PostWidget::updateUi appears to be significantly broken, full of elements that seem either unitialized or damaged. Selected fields and gdb output: (gdb) up #1 0x0000003eed489910 in QDateTime::isValid (this=0x94c7d88) at tools/qdatetime.cpp:2225 2225 return d->date.isValid() && d->time.isValid(); (gdb) print d $1 = {d = 0x0} (gdb) print this $2 = (const QDateTime * const) 0x94c7d88 (gdb) print *this $3 = {d = {d = 0x0}} (gdb) up #3 0x00000038a924ec47 in Choqok::UI::PostWidget::updateUi (this=0xafb47d0) at /usr/src/debug/choqok-1.3/libchoqok/ui/postwidget.cpp:246 (gdb) print *(d->mCurrentPost.content->d) $20 = {ref = {_q_value = 96}, alloc = 0, size = 65, data = 0xe00000001, clean = 0, simpletext = 1, righttoleft = 1, asciiCache = 1, capacity = 0, reserved = 0, array = {0}} (gdb) print *(d->mCurrentPost.link->d) $22 = {ref = {_q_value = 226771920}, alloc = 0, size = 26837008, data = 0x30dc803bc0 <QMenu::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}} (gdb) print d->mCurrentPost.isPrivate $26 = true Please let me know if you'd like me to dump any specific things through gdb (this crash happens reasonably frequently).
Created attachment 80888 [details] New crash information added by DrKonqi choqok (1.3.1) on KDE Platform 4.10.4 using Qt 4.8.4 - What I was doing when the application crashed: Choqok crashed suddenly, no idea why it happens. Crashed twice. Will observe more. -- Backtrace (Reduced): #5 QDate::isValid (this=0x20005) at tools/qdatetime.cpp:330 #6 0x00007fba78bddb10 in QDateTime::isValid (this=0x3c1ed48) at tools/qdatetime.cpp:2225 #7 0x00007fba7a5333bd in Choqok::UI::PostWidget::formatDateTime(QDateTime const&) () from /usr/lib/libchoqok.so.1 #8 0x00007fba7a53368f in Choqok::UI::PostWidget::updateUi() () from /usr/lib/libchoqok.so.1 [...] #10 0x00007fba78cf59b1 in QObject::event (this=0x3c56280, e=<optimized out>) at kernel/qobject.cpp:1156
I'm getting this every day or so since updating to master. Some observations: - As Chris Siebenmann noticed, there definitely seems to be some memory corruption in mCurrentPost. - I'd assumed that this was due to one of the Post/ PostWidget being deleted before the call to updateUI(), but having inspected the code, and added some debug statements tracking the creation/ destruction of these objects add the calls to updateUI, I can find no evidence of this. - I added a search for "justinbieber" (an acceptable sacrifice in this instance, I think) and left it running on the theory that having massive turnover in new posts would trigger the crash earlier, but this didn't seem to be the case, either. I'll try running it in valgrind, next.
Created attachment 81290 [details] Relevant valgrind log excerpt
I am also experiencing this bug, and I suspend my system frequently. I have also been running choqok in valgrind for a few days, and after a long suspend today I encountered a number of valgrind errors in the log (though choqok did not crash). I have attached the relevant portion of the log above; there are several more errors of the same form in the actual log. Contrary to what Simon said above, updateUI() *does* seem to be called on deleted PostWidget instances. Combining these logs and the stacktrace in the original bug report makes me suspect that the 1-minute QTimer calling updateUI() to update the "x minutes ago" UI element fires for PostWidgets that have already fallen off the timeline due to their age.
Created attachment 81291 [details] Valgrind and debugging log Oops - forgot to add my own log :) As Benedikt notes, I was wrong about the de-referencing of deleted code: it looks a Post (although I don't think a PostWidget) is accessed after it is deleted. Check out the Post with address 0x1296deb0 in the log: it is deleted at 07:26:54, add no Post is re-created with the same address, and is then de-referenced at 07:30:24. This post seems to have two containing PostWidgets: 0x6fb6da8 and 0xe7bc188, which would account for the problem.
Created attachment 81292 [details] Valgrind and debugging log Whoops - somehow attached the wrong log last time! Here's the right one (I hope!)
Aha - viewing a thread/ conversation (clicking on the little "finger-pointing-at-man" icon, after "in reply to @personsname") can create a PostWidget with a Post that already has a containing PostWidget, leading to eventual double-deletion - so you need to prevent that, or come up with an alternative Post ownership scheme.
Tricky to reproduce: basically, what happens is this: 1) Click on the icon that shows the thread for some conversation. TwitterApiShowThread will create a PostWidget (P2, say) that wraps finalPost, which already be wrapped by some existing PostWidget (P1, say). 2) TwitterApiShowThread - and so, the PostWidget P2 it created - never seems to be deleted. P2 will then periodically receive calls to updateUi() until Choqok is closed. 3) Eventually, the original PostWidget P1 will be deleted (because it fell off the bottom of a timeline, say). finalPost is then deleted. 4) During a call to updateUi() on P2, P2 will attempt to access finalPost, which is Undefined Behaviour. I've managed to deliberately reproduce this once now within a few minutes by arranging the "Number of Posts to Show in Timelines" so that the last post in my timeline is a reply to another post; clicking to view the conversation; and then waiting for that post to fall off the bottom of the timeline and for the post in the conversation window to updateUi itself, but it's not always reliable: there seems to be some subtlety as to whether P1 gets deleted when the post falls off the timeline. Anyway, hope this helps!
Created attachment 81410 [details] Primitive reference counting for Post/PostWidget relations In accordance with Simon's investigative results, I have added some primitive reference counting for Post/PostWidget relations. While this is certainly not the /correct/ way to fix the bug (not thread-safe, design-respecting, etc.), I've been trying to provoke a crash with this fix applied and have been unsuccessful so far, so it restores my user experience. If anyone wants to try it out themselves, I have attached a patch against the 1.3.1 sources shipped with Fedora 19 (but manual patching should be easy also). Note that this patch changes libchoqok API, however no packages besides choqok itself depend on libchoqok in my distribution's entire package directory, so I don't expect any problems in that regard.
*** Bug 323108 has been marked as a duplicate of this bug. ***
For what it's worth: I've been using Benedikt Gollatz's patch on top of the current git version all this week (on two different machines) and haven't had a single choqok crash (which is much, much better than I was managing before). I don't see any obvious signs that my choqok is leaking memory or otherwise malfunctioning.
Created attachment 81681 [details] New crash information added by DrKonqi choqok (1.3.1) on KDE Platform 4.10.97 using Qt 4.8.4 - What I was doing when the application crashed: I was using Choqok from my development build and clicked on a tweet. - Unusual behavior I noticed: The GUI froze for a moment. - Custom settings of the application: Toolbar's on the top with the different fields. -- Backtrace (Reduced): #6 QDate::isValid (this=0x10000000104) at tools/qdatetime.cpp:330 #7 0x00007f58633b8b70 in QDateTime::isValid (this=this@entry=0x4350f28) at tools/qdatetime.cpp:2225 #8 0x00007f5864bfb094 in Choqok::UI::PostWidget::formatDateTime (this=0x685c5e0, time=...) at /home/jacky/Development/Projects/choqok/libchoqok/ui/postwidget.cpp:458 #9 0x00007f5864bf919c in Choqok::UI::PostWidget::updateUi (this=0x685c5e0) at /home/jacky/Development/Projects/choqok/libchoqok/ui/postwidget.cpp:250 [...] #11 0x00007f58634c13ec in QObject::event (this=0x4333320, e=<optimized out>) at kernel/qobject.cpp:1156
Created attachment 81730 [details] New crash information added by DrKonqi choqok (1.3.1) on KDE Platform 4.11.00 using Qt 4.8.4 - What I was doing when the application crashed: Having Choqok run in the background, I continued about my work. I noticed that it crashed precisely three minutes after its last update. -- Backtrace (Reduced): #6 QDate::isValid (this=0x1000000a6) at tools/qdatetime.cpp:330 #7 0x00007fe0bd5a2b70 in QDateTime::isValid (this=this@entry=0x4e59cd8) at tools/qdatetime.cpp:2225 #8 0x00007fe0bede5094 in Choqok::UI::PostWidget::formatDateTime (this=0x317dda0, time=...) at /home/jacky/Development/Projects/choqok/libchoqok/ui/postwidget.cpp:458 #9 0x00007fe0bede319c in Choqok::UI::PostWidget::updateUi (this=0x317dda0) at /home/jacky/Development/Projects/choqok/libchoqok/ui/postwidget.cpp:250 [...] #11 0x00007fe0bd6ab3ec in QObject::event (this=0x14b2e90, e=<optimized out>) at kernel/qobject.cpp:1156
Created attachment 81736 [details] New crash information added by DrKonqi choqok (1.3.1) on KDE Platform 4.11.00 using Qt 4.8.4 - What I was doing when the application crashed: Having Choqok run in the background causes Choqok to crash occasionally. -- Backtrace (Reduced): #6 QDate::isValid (this=0x2b00000004) at tools/qdatetime.cpp:330 #7 0x00007fabe5599b70 in QDateTime::isValid (this=this@entry=0x3483c18) at tools/qdatetime.cpp:2225 #8 0x00007fabe6ddc094 in Choqok::UI::PostWidget::formatDateTime (this=0x5398b20, time=...) at /home/jacky/Development/Projects/choqok/libchoqok/ui/postwidget.cpp:458 #9 0x00007fabe6dda19c in Choqok::UI::PostWidget::updateUi (this=0x5398b20) at /home/jacky/Development/Projects/choqok/libchoqok/ui/postwidget.cpp:250 [...] #11 0x00007fabe56a23ec in QObject::event (this=0x3e9c540, e=<optimized out>) at kernel/qobject.cpp:1156
Created attachment 81751 [details] New crash information added by DrKonqi choqok (1.3.1) on KDE Platform 4.11.00 using Qt 4.8.4 - What I was doing when the application crashed: Having Choqok run in the background causes to randomly crash. -- Backtrace (Reduced): #6 QDate::isValid (this=0x61007400730033) at tools/qdatetime.cpp:330 #7 0x00007f0d07429b70 in QDateTime::isValid (this=this@entry=0x623f5e8) at tools/qdatetime.cpp:2225 #8 0x00007f0d08c6c094 in Choqok::UI::PostWidget::formatDateTime (this=0x4dc9630, time=...) at /home/jacky/Development/Projects/choqok/libchoqok/ui/postwidget.cpp:458 #9 0x00007f0d08c6a19c in Choqok::UI::PostWidget::updateUi (this=0x4dc9630) at /home/jacky/Development/Projects/choqok/libchoqok/ui/postwidget.cpp:250 [...] #11 0x00007f0d075323ec in QObject::event (this=0x3a1a980, e=<optimized out>) at kernel/qobject.cpp:1156
Created attachment 81929 [details] New crash information added by DrKonqi choqok (1.3.1) on KDE Platform 4.8.5 (4.8.5) using Qt 4.8.1 - What I was doing when the application crashed: The application was in the background and crashed. Seems to be the same backtrace than the main bug. -- Backtrace (Reduced): #6 QDate::isValid (this=0x4) at tools/qdatetime.cpp:330 #7 0x00007f2431ffdf00 in QDateTime::isValid (this=0x6040588) at tools/qdatetime.cpp:2225 #8 0x00007f2433876d9c in Choqok::UI::PostWidget::formatDateTime (this=0x3102850, time=...) at /home/tails/choqok/libchoqok/ui/postwidget.cpp:458 #9 0x00007f2433877328 in Choqok::UI::PostWidget::updateUi (this=0x3102850) at /home/tails/choqok/libchoqok/ui/postwidget.cpp:250 [...] #11 0x00007f2432108179 in QObject::event (this=0x71d0a20, e=<optimized out>) at kernel/qobject.cpp:1157
Git commit 26d2c2a50ee7a6e5c4d5309a8abfba6ea00709b7 by Mehrdad Momeny. Committed on 31/08/2013 at 03:29. Pushed by momeny into branch 'master'. Patch provided from Benedikt Gollatz added to prevent the crash M +2 -1 libchoqok/choqoktypes.h M +5 -1 libchoqok/ui/postwidget.cpp http://commits.kde.org/choqok/26d2c2a50ee7a6e5c4d5309a8abfba6ea00709b7