Bug 364005 - ASSERT: "!mReadingFinished" when composing a message
Summary: ASSERT: "!mReadingFinished" when composing a message
Status: RESOLVED FIXED
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: server (show other bugs)
Version: GIT (master)
Platform: Other Linux
: NOR crash (vote)
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-05 21:15 UTC by Christophe Giboudeaux
Modified: 2016-06-18 16:01 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christophe Giboudeaux 2016-06-05 21:15:53 UTC
Using master, the crash is reproducible.

In KMail, press the "new message button", enter the beginning of an existing address, let the autocompletion suggest something and select it.

Press enter, KMail then crashes :

23:09:29 - kmail2(3902) - akonadicore_log: : Received response for a job that does not expect any more data, ignoring
23:09:29 - kmail2(3902) -  : ASSERT: "!mReadingFinished" in file /kde/src/5/akonadiserver/src/core/jobs/job.cpp, line 67


#4  0x00007ffff56f4f1e in qt_assert(char const*, char const*, int) (assertion=<optimized out>, file=<optimized out>, line=<optimized out>) at global/qglobal.cpp:2999
#5  0x00007fffee7349a3 in Akonadi::JobPrivate::handleResponse(long long, Akonadi::Protocol::Command const&) (this=0x317ab40, tag=7, response=...) at /kde/src/5/akonadiserver/src/core/jobs/job.cpp:67
#6  0x00007fffee6f656c in Akonadi::SessionPrivate::handleCommand(long long, Akonadi::Protocol::Command const&) (this=0x2746ca0, tag=7, cmd=...) at /kde/src/5/akonadiserver/src/core/session.cpp:143
#7  0x00007fffee6f8257 in Akonadi::Session::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (_o=0x1c629e0, _c=QMetaObject::InvokeMetaMethod, _id=4, _a=0x7fff38004750) at /kde/build/5/akonadiserver/src/core/moc_session.cpp:117
#8  0x00007ffff59023d1 in QObject::event(QEvent*) (this=0x1c629e0, e=<optimized out>) at kernel/qobject.cpp:1256
#9  0x00007ffff65fd30c in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=<optimized out>, receiver=0x1c629e0, e=0x7fff38005440) at kernel/qapplication.cpp:3804
#10 0x00007ffff6602486 in QApplication::notify(QObject*, QEvent*) (this=0x7fffffffd1b0, receiver=0x1c629e0, e=0x7fff38005440) at kernel/qapplication.cpp:3561
#11 0x00007ffff58d66e8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x1c629e0, event=event@entry=0x7fff38005440) at kernel/qcoreapplication.cpp:1015
#12 0x00007ffff58d84ca in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (event=0x7fff38005440, receiver=<optimized out>) at kernel/qcoreapplication.h:225
#13 0x00007ffff58d84ca in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (receiver=receiver@entry=0x0, event_type=event_type@entry=0, data=0x628540) at kernel/qcoreapplication.cpp:1650
#14 0x00007ffff58d8988 in QCoreApplication::sendPostedEvents(QObject*, int) (receiver=receiver@entry=0x0, event_type=event_type@entry=0) at kernel/qcoreapplication.cpp:1508
#15 0x00007ffff5928733 in postEventSourceDispatch(GSource*, GSourceFunc, gpointer) (s=0x6bfd00) at kernel/qeventdispatcher_glib.cpp:270
#16 0x00007fffea183227 in g_main_context_dispatch () at /usr/lib64/libglib-2.0.so.0
Comment 1 Daniel Vrátil 2016-06-15 11:46:44 UTC
Yeah, this were a bugs we were trying to debug with dfaure - sometimes a job was getting response that belonged to previous job which has ended, or has signaled that it has ended and then another response arrived and the job emitted another signal.

The assert helped us catch all the broken jobs and bugs in Job handling. The last issue that triggers the assert is when a job is manually killed and the session is restarted - which is exactly what happens in the completion code in composer when you type fast enough so the composer kills the running ContactSearchJob and starts a new one. I'm still trying to figure out how to properly handle that, for now please just comment-out the Q_ASSERT.
Comment 2 Daniel Vrátil 2016-06-18 10:39:11 UTC
Git commit d5c6a12a10dbe58384676a8777c871c1bebc1744 by Daniel Vrátil.
Committed on 18/06/2016 at 10:33.
Pushed by dvratil into branch 'master'.

Session: connect to KJob::finished() rather than result()

KJob::result() is not emitted when job is killed quietly which prevents
Session from scheduling the next job until the killed job is destroyed.
This leads to responses being delivered to a wrong job when the job is
killed.
CCMAIL: faure@kde.org

M  +2    -0    src/core/jobs/job.cpp
M  +1    -1    src/core/session.cpp

http://commits.kde.org/akonadi/d5c6a12a10dbe58384676a8777c871c1bebc1744
Comment 3 Christophe Giboudeaux 2016-06-18 15:43:45 UTC
Well, it still crashes with the same bt:

#7  0x00007f4306756f1e in qt_assert(char const*, char const*, int) (assertion=<optimized out>, file=<optimized out>, line=<optimized out>) at global/qglobal.cpp:2999
#8  0x00007f42ff57bc58 in Akonadi::JobPrivate::handleResponse(long long, Akonadi::Protocol::Command const&) (this=0x479a660, tag=12, response=...) at /kde/src/5/akonadiserver/src/core/jobs/job.cpp:69
#9  0x00007f42ff53d5d8 in Akonadi::SessionPrivate::handleCommand(long long, Akonadi::Protocol::Command const&) (this=0x3c483d0, tag=12, cmd=...) at /kde/src/5/akonadiserver/src/core/session.cpp:143
#10 0x00007f42ff53f2c3 in Akonadi::Session::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (_o=0x3c359d0, _c=QMetaObject::InvokeMetaMethod, _id=4, _a=0x7f425800cac0) at /kde/build/5/akonadiserver/src/core/moc_session.cpp:117
Comment 4 Christophe Giboudeaux 2016-06-18 16:01:09 UTC
false alarm, deleting the whole build dir helped.