Bug 381636 - Clicking Server->Start, the program crash
Summary: Clicking Server->Start, the program crash
Status: RESOLVED FIXED
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: akonadiconsole (show other bugs)
Version: unspecified
Platform: Fedora RPMs Linux
: NOR crash
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-25 09:13 UTC by Giuseppe Della Bianca
Modified: 2019-02-22 09:53 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
strace akonadiconsole (4.48 KB, text/plain)
2017-06-25 09:13 UTC, Giuseppe Della Bianca
Details
gud-akonadikonsole (4.44 KB, text/plain)
2017-06-26 18:28 UTC, Giuseppe Della Bianca
Details
output of akonadikonsole (5.71 KB, text/plain)
2017-06-26 18:29 UTC, Giuseppe Della Bianca
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Giuseppe Della Bianca 2017-06-25 09:13:13 UTC
Created attachment 106286 [details]
strace akonadiconsole

In a fedora 23 updated to 26

akonadiconsole 0.99
KDE Frameworks 5.35.0
Qt 5.7.1
Linux (x86_64) release 4.11.5-300.fc26.x86_64


Clicking Server-> Start, the program crash.

Maybe because of that

write(2, "QSocketNotifier: Socket notifier"..., 84QSocketNotifier: Socket notifiers cannot be enabled or disabled from another thread
Comment 1 Christoph Feck 2017-06-26 12:33:08 UTC
Could you please try running it in gdb to obtain a backtrace?

> gdb akonadiconsole
> run
(reproduce crash)
> bt full
Comment 2 Giuseppe Della Bianca 2017-06-26 18:28:53 UTC
Created attachment 106315 [details]
gud-akonadikonsole
Comment 3 Giuseppe Della Bianca 2017-06-26 18:29:29 UTC
Created attachment 106316 [details]
output of akonadikonsole
Comment 4 Christoph Feck 2017-06-26 20:44:46 UTC
Funny, it only tries to print a qWarning, and crashes in strlen.

Thread 5 "QThread" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffb67ec700 (LWP 7741)]
0x00007fffed147fe6 in strlen () from /lib64/libc.so.6
(gdb) backtrace full
#0  0x00007fffed147fe6 in strlen () at /lib64/libc.so.6
#1  0x00007fffede61a29 in QString::vasprintf(char const*, __va_list_tag*) () at /lib64/libQt5Core.so.5
#2  0x00007fffeddcce3b in qt_message(QtMsgType, QMessageLogContext const&, char const*, __va_list_tag*) () at /lib64/libQt5Core.so.5
#3  0x00007fffeddcdbbb in QMessageLogger::warning(char const*, ...) const () at /lib64/libQt5Core.so.5
#4  0x00007fffedfd6b39 in socketNotifierSourceCheck(_GSource*) () at /lib64/libQt5Core.so.5
#5  0x00007fffdd09bfc9 in g_main_context_check () at /lib64/libglib-2.0.so.0
#6  0x00007fffdd09c540 in g_main_context_iterate.isra () at /lib64/libglib-2.0.so.0
#7  0x00007fffdd09c6ac in g_main_context_iteration () at /lib64/libglib-2.0.so.0
#8  0x00007fffedfd6d0b in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt5Core.so.5
#9  0x00007fffedf86b8a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt5Core.so.5
#10 0x00007fffedddbefa in QThread::exec() () at /lib64/libQt5Core.so.5
#11 0x00007fffedde01ee in QThreadPrivate::start(void*) () at /lib64/libQt5Core.so.5
#12 0x00007ffff346536d in start_thread () at /lib64/libpthread.so.0
#13 0x00007fffed1c4b9f in clone () at /lib64/libc.so.6
Comment 5 Giuseppe Della Bianca 2017-06-27 21:22:09 UTC
My knowledge of Qt is less than zero.
I just noticed that QSocketNotifier object data contains abnormal or invalid values.

The messages

'QSocketNotifier: Invalid socket 12 and type' Read ', disabling ...'

are the first symptom of a problem that is already done.

They seem to have problems using destroyed object, notifications that are still active while their handler is being destroyed, or perhaps memory overwrite.
Comment 6 Giuseppe Della Bianca 2017-07-02 21:32:50 UTC
Connection::~Connection()
{
    delete mLogFile;
    if (mSocket) {
        mSocket->disconnect(this);
>>>>        mSocket->close();   <<<<<
        delete mSocket;
    }
}

mSocket is created by a thread and closed by another, this causes an assert failed

    Q_ASSERT_X(currentThread == thr || !thr,
Comment 7 David E. Narvaez 2019-02-22 09:53:30 UTC
Git commit a9570303d08a1b2099d862f115c8f2b99fe0fbc7 by David E. Narváez.
Committed on 22/02/2019 at 09:53.
Pushed by narvaez into branch 'Applications/18.12'.

Destroy the Connection Through the Session Thread

Summary:
This is the proper way to destroy a server connection.

Reviewers: #kde_pim, dvratil

Reviewed By: #kde_pim, dvratil

Subscribers: dvratil, kde-pim

Tags: #kde_pim

Differential Revision: https://phabricator.kde.org/D19212

M  +1    -1    src/core/session.cpp

https://commits.kde.org/akonadi/a9570303d08a1b2099d862f115c8f2b99fe0fbc7