Bug 392092 - akonadi_control crash on first start
Summary: akonadi_control crash on first start
Status: RESOLVED FIXED
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.8.1
Platform: Neon Linux
: NOR crash (vote)
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
: 382833 402619 404390 404414 406038 407070 409584 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-03-20 08:45 UTC by Martin Tlustos
Modified: 2019-07-07 17:32 UTC (History)
10 users (show)

See Also:
Latest Commit:
Version Fixed In: 19.04.3


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Tlustos 2018-03-20 08:45:09 UTC
for a few days now akonadi_control crashes when I start kontact. It automatically restarts itself, so that's fine, but I still wanted to post the crash information:

Application: akonadi_control (akonadi_control), signal: Aborted
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[KCrash Handler]
#6  0x00007f845585b428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#7  0x00007f845585d02a in __GI_abort () at abort.c:89
#8  0x00007f8456220311 in qt_message_fatal (context=..., message=<synthetic pointer>) at global/qlogging.cpp:1710
#9  QMessageLogger::fatal (this=this@entry=0x7ffeecfc5b50, msg=msg@entry=0x438ef0 "Cannot remove old log file - running on a readonly filesystem maybe?") at global/qlogging.cpp:816
#10 0x000000000042f47f in akInit (appName=...) at /workspace/build/src/shared/akdebug.cpp:195
#11 0x000000000042d1f2 in AkApplicationBase::init (this=this@entry=0x7ffeecfc5e10) at /workspace/build/src/shared/akapplication.cpp:61
#12 0x0000000000409f3b in AkApplicationImpl<QGuiApplication>::AkApplicationImpl (loggingCategory=..., argv=0x7ffeecfc5f78, argc=@0x7ffeecfc5c7c: 1, this=0x7ffeecfc5e10) at /workspace/build/src/shared/akapplication.h:83
#13 main (argc=1, argv=0x7ffeecfc5f78) at /workspace/build/src/akonadicontrol/main.cpp:55

Also I don't know how to get version information about akonadi as it does not have a version dialogue, so I put "unspecified". It's the latest NEON packages, though...
Comment 1 Martin Tlustos 2018-03-28 04:49:18 UTC
It seems that this crash occurs only if you start kontact right after computer startup. If you start it after a while, the crash does not occur.
Comment 2 Martin Tlustos 2018-04-25 12:18:10 UTC
It now seems to happen every time. Crash information:

Application: akonadi_control (akonadi_control), signal: Aborted
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[KCrash Handler]
#6  0x00007f5d3645a428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#7  0x00007f5d3645c02a in __GI_abort () at abort.c:89
#8  0x00007f5d36e1f311 in qt_message_fatal (context=..., message=<synthetic pointer>) at global/qlogging.cpp:1710
#9  QMessageLogger::fatal (this=this@entry=0x7fff8d48d930, msg=msg@entry=0x437280 "Cannot rename log file - running on a readonly filesystem maybe?") at global/qlogging.cpp:816
#10 0x000000000042d783 in akInit (appName=...) at /workspace/build/src/shared/akdebug.cpp:215
#11 0x000000000042b792 in AkApplicationBase::init (this=this@entry=0x7fff8d48dbf0) at /workspace/build/src/shared/akapplication.cpp:61
#12 0x000000000040a0cb in AkApplicationImpl<QGuiApplication>::AkApplicationImpl (loggingCategory=..., argv=0x7fff8d48dd58, argc=@0x7fff8d48da5c: 1, this=0x7fff8d48dbf0) at /workspace/build/src/shared/akapplication.h:83
#13 main (argc=1, argv=0x7fff8d48dd58) at /workspace/build/src/akonadicontrol/main.cpp:55
Comment 3 Christophe Giboudeaux 2018-04-26 08:07:24 UTC
#9  QMessageLogger::fatal (this=this@entry=0x7fff8d48d930, msg=msg@entry=0x437280 "Cannot rename log file - running on a readonly filesystem maybe?") at global/qlogging.cpp:816

what kind of partition is that ? does your user have write access to ~/.config/akonadi* and ~/.local/share/akonadi ?

Any error in the dmesg output ?
Comment 4 Martin Tlustos 2018-04-26 11:10:46 UTC
It's all under my home folder, I have access to everything (although I redid it, just to make sure...).
Again, the error is not reproduced if I stop kontact/akonadi and later restart it. It just happens the first time after booting up the machine.
Comment 5 Martin Tlustos 2018-04-26 11:20:31 UTC
No connection to opening kwallet at first time after login either, I just closed my wallet and let akonadi reopen it (with password etc.)
Comment 6 Martin Tlustos 2018-04-27 06:21:24 UTC
starting akonadi via akonadictl start does not produce any errors in konsole. Starting kontact in konsole will produce the same "Cannot rename log file - running on a readonly filesystem maybe?" error.
Comment 7 Martin Tlustos 2018-04-27 06:48:22 UTC
more testing:
starting kmail from konsole will render the same error.
starting korganizer from konsole will crash akonadi_control, but with a different error:
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
kf5.kservice.services: KServiceTypeTrader: serviceType "KOrganizer/Part" not found
akonadi.collectionattributetable                   OK
akonadi.collectionmimetyperelation                 OK
akonadi.collectionpimitemrelation                  OK
akonadi.collectiontable                            OK
akonadi.flagtable                                  OK
akonadi.mimetypetable                              OK
akonadi.parttable                                  OK
akonadi.parttypetable                              OK
akonadi.pimitemflagrelation                        OK
akonadi.pimitemtable                               OK
akonadi.pimitemtagrelation                         OK
akonadi.relationtable                              OK
akonadi.relationtypetable                          OK
akonadi.resourcetable                              OK
akonadi.schemaversiontable                         OK
akonadi.tagattributetable                          OK
akonadi.tagremoteidresourcerelationtable           OK
akonadi.tagtable                                   OK
akonadi.tagtypetable                               OK
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
true
true
.....
Comment 8 Rex Dieter 2018-04-30 14:41:23 UTC
Seeing another downstream user seemingly getting this semi-often,
https://bugzilla.redhat.com/show_bug.cgi?id=1448691
Comment 9 BingMyBong 2018-06-17 12:19:17 UTC
Happening on opensuse:tumbleweed:20180613 as well
Qt: 5.11.0 KDE Frameworks: 5.46.0 - KDE Plasma:  5.13.0 - kwin 5.13.0
kmail2 5.8.2 - akonadiserver 5.8.2 - Kernel:  4.16.12-3-default  - 

Application: akonadi_control (akonadi_control), signal: Aborted
Using host libthread_db library "/lib64/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f5d3dff6800 (LWP 9255))]

Thread 2 (Thread 0x7f5d310ee700 (LWP 9256)):
#0  0x00007f5d3bb3c5d9 in poll () from /lib64/libc.so.6
#1  0x00007f5d381ea377 in ?? () from /usr/lib64/libxcb.so.1
#2  0x00007f5d381ebf8a in xcb_wait_for_event () from /usr/lib64/libxcb.so.1
#3  0x00007f5d340c8939 in ?? () from /usr/lib64/libQt5XcbQpa.so.5
#4  0x00007f5d3c47993c in ?? () from /usr/lib64/libQt5Core.so.5
#5  0x00007f5d3b834554 in start_thread () from /lib64/libpthread.so.0
#6  0x00007f5d3bb46fdf in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7f5d3dff6800 (LWP 9255)):
[KCrash Handler]
#6  0x00007f5d3ba8424b in raise () from /lib64/libc.so.6
#7  0x00007f5d3ba6d4f1 in abort () from /lib64/libc.so.6
#8  0x00007f5d3c43a22b in QMessageLogger::fatal(char const*, ...) const () from /usr/lib64/libQt5Core.so.5
#9  0x0000562e57e1d93b in ?? ()
#10 0x0000562e57e40402 in ?? ()
#11 0x0000562e57e1daa8 in ?? ()
#12 0x00007f5d3ba6f11b in __libc_start_main () from /lib64/libc.so.6
#13 0x0000562e57e1e1aa in _start ()
Comment 10 PK 2018-06-18 05:51:45 UTC
I have the same experience. I think it started from the moment I installed plasma 5.13 on my system. I'm using KDE Neon user build.
Comment 11 PK 2018-06-18 05:58:30 UTC
After starting up kmail I get this grey screen. But I can access the settings. When I start the account-wizzard from there after a while the akonadi self-test starts. And again it says that "akonadi is not registered at dbus".
Comment 12 PK 2018-06-21 10:07:19 UTC
I installed a package called mariadb-server and it seems as if things are better now.
Comment 13 Daniel Vrátil 2018-07-05 13:56:31 UTC
Git commit 4bd807c28663556c7e84c841d45f2d31803755bb by Daniel Vrátil.
Committed on 05/07/2018 at 13:55.
Pushed by dvratil into branch 'Applications/18.04'.

akInit: improve error message when renaming old logfiles fails

Tell us which file caused the error and what the error was.

M  +9    -3    src/shared/akdebug.cpp

https://commits.kde.org/akonadi/4bd807c28663556c7e84c841d45f2d31803755bb
Comment 14 Christoph Feck 2019-01-17 02:24:00 UTC
*** Bug 402619 has been marked as a duplicate of this bug. ***
Comment 15 Christoph Feck 2019-01-17 02:25:18 UTC
*** Bug 382833 has been marked as a duplicate of this bug. ***
Comment 16 Christoph Feck 2019-03-08 19:37:42 UTC
*** Bug 404414 has been marked as a duplicate of this bug. ***
Comment 17 Christoph Feck 2019-03-09 00:58:46 UTC
*** Bug 404390 has been marked as a duplicate of this bug. ***
Comment 18 Martin Tlustos 2019-03-20 06:55:52 UTC
Still happening

Operating System: KDE neon 5.15
KDE Plasma Version: 5.15.3
KDE Frameworks Version: 5.56.0
Qt Version: 5.12.0
Kernel Version: 4.15.0-46-generic
OS Type: 64-bit
Processors: 4 × Intel® Core™ i5-7200U CPU @ 2.50GHz
Memory: 7,7 GiB

Crash info:
Application: akonadi_control (akonadi_control), signal: Aborted
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Current thread is 1 (Thread 0x7fcc0ea82800 (LWP 11570))]

Thread 2 (Thread 0x7fcc03050700 (LWP 11572)):
#0  0x00007fcc0c4f3bf9 in __GI___poll (fds=0x7fcc0304fcb8, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007fcc089d3747 in ?? () from /usr/lib/x86_64-linux-gnu/libxcb.so.1
#2  0x00007fcc089d536a in xcb_wait_for_event () from /usr/lib/x86_64-linux-gnu/libxcb.so.1
#3  0x00007fcc045cb32a in QXcbEventQueue::run (this=0x560046f45200) at qxcbeventqueue.cpp:225
#4  0x00007fcc0ce18bc2 in QThreadPrivate::start (arg=0x560046f45200) at thread/qthread_unix.cpp:361
#5  0x00007fcc0c1c76db in start_thread (arg=0x7fcc03050700) at pthread_create.c:463
#6  0x00007fcc0c50088f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 1 (Thread 0x7fcc0ea82800 (LWP 11570)):
[KCrash Handler]
#6  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#7  0x00007fcc0c41f801 in __GI_abort () at abort.c:79
#8  0x00007fcc0cdf4e7b in qt_message_fatal (context=..., message=<synthetic pointer>...) at global/qlogging.cpp:1901
#9  QMessageLogger::fatal (this=this@entry=0x7ffe85788010, msg=msg@entry=0x5600461de1a0 "Cannot rename log file '%s' to '%s': %s") at global/qlogging.cpp:887
#10 0x00005600461d2701 in akInit (appName=...) at ./src/shared/akdebug.cpp:218
#11 0x00005600461d0762 in AkApplicationBase::init (this=0x7ffe857881b0) at ./src/shared/akapplication.cpp:62
#12 0x00005600461b1138 in AkApplicationImpl<QGuiApplication>::AkApplicationImpl (loggingCategory=..., argv=0x7ffe85788318, argc=@0x7ffe8578812c: 1, this=0x7ffe857881b0) at ./src/shared/akapplication.h:83
#13 main (argc=<optimized out>, argv=0x7ffe85788318) at ./src/akonadicontrol/main.cpp:55
Comment 19 Christoph Feck 2019-04-19 11:26:35 UTC
*** Bug 406038 has been marked as a duplicate of this bug. ***
Comment 20 Christoph Feck 2019-04-19 11:27:46 UTC
Martin, could you please add the Konsole output? It should show which files it fails to rename, and why.
Comment 21 Christoph Feck 2019-05-14 20:09:04 UTC
*** Bug 407070 has been marked as a duplicate of this bug. ***
Comment 22 tom 2019-06-13 17:32:58 UTC
Same here with gentoo amd64, akonadi version 5.10.3
I was able to get a konsole output that tells the log file name when I start kmail for the first time after reboot:

Cannot rename log file '/home/tom/.local/share/akonadi/akonadi_control.error' to '/home/tom/.local/share/akonadi/akonadi_control.error.old': Cannot create /home/tom/.local/share/akonadi/akonadi_control.error.old for output 
 KCrash: Application 'akonadi_control' crashing... 
 KCrash: Attempting to start /usr/lib64/libexec/drkonqi from kdeinit 
 sock_file=/var/run/user/1000/kdeinit5__0 
 Nouveau openGL driver detected. Qt WebEngine will disable usage of the GPU. 
 Note: you can set the QT_WEBENGINE_DISABLE_NOUVEAU_WORKAROUND 
 environment variable before running this application, but this is 
 not recommended since this usually causes applications to crash as 
 Nouveau openGL drivers don't support multithreaded rendering 
 QDBusConnection: name 'org.kde.kwalletd5' had owner '' but we thought it was ':1.60'

Created an additional patch to get some more debug information:

--- a/src/shared/akdebug.cpp.a       2019-03-03 23:03:57.000000000 +0100 
 +++ b/src/shared/akdebug.cpp 2019-06-11 18:57:00.375941258 +0200 
 @@ -200,6 +200,8 @@ void akInit(const QString &appName) 
      const auto errorLogFile = DebugPrivate::errorLogFileName(name); 
      QFileInfo infoOld(errorLogFile + QLatin1String(".old")); 
      if (infoOld.exists()) { 
 +       qCritical("Old log file '%s' exists. deleting...",qUtf8Printable(infoOld.fileName())); 
          QFile fileOld(infoOld.absoluteFilePath()); 
 +       qCritical("Old log file (complete) '%s' exists. deleting...",qUtf8Printable(fileOld.fileName())); 
          const bool success = fileOld.remove(); 
          if (!success) { 
 @@ -207,6 +208,8 @@ void akInit(const QString &appName) 
                  qUtf8Printable(fileOld.fileName()), 
                  qUtf8Printable(fileOld.errorString())); 
          } 
 +    } else { 
 +       qCritical("Old log file '%s' does not exist",qUtf8Printable(infoOld.fileName())); 
      } 
   
      QFileInfo info(errorLogFile); 
 @@ -219,7 +222,11 @@ void akInit(const QString &appName) 
                     qUtf8Printable(file.fileName()), 
                     qUtf8Printable(oldName), 
                     qUtf8Printable(file.errorString())); 
 +        } else { 
 +         qCritical("log file '%s' renamed",qUtf8Printable(file.fileName())); 
          } 
 +    } else { 
 +       qCritical("no log file to rename."); 
      } 
   
      QtMessageHandler origHandler = qInstallMessageHandler(akMessageHandler);


which results in this output when akonadi crashes:

Old log file 'akonadi_control.error.old' exists. deleting... 
 Old log file (complete) '/home/tom/.local/share/akonadi/akonadi_control.error.old' exists. deleting... 
 Cannot rename log file '/home/tom/.local/share/akonadi/akonadi_control.error' to '/home/tom/.local/share/akonadi/akonadi_control.error.old': Cannot create /home/tom/.local/share/akonadi/akonadi_control.error.old for output 
 KCrash: Application 'akonadi_control' crashing... 
 KCrash: Attempting to start /usr/lib64/libexec/drkonqi from kdeinit 
 sock_file=/var/run/user/1000/kdeinit5__0 
 Nouveau openGL driver detected. Qt WebEngine will disable usage of the GPU. 
 Note: you can set the QT_WEBENGINE_DISABLE_NOUVEAU_WORKAROUND 
 environment variable before running this application, but this is 
 not recommended since this usually causes applications to crash as 
 Nouveau openGL drivers don't support multithreaded rendering 
 QDBusConnection: name 'org.kde.kwalletd5' had owner '' but we thought it was ':1.53'

the log files are in my home folder and there are no access restrictions for my user for the folder or the files. I can rename or delete the files manually without error messages.
It looks to me like the deletion of the .old file is not done even if fileOld.remove() returns success, or if there is some kind of race condition (this is all wild guess).

Also reported here:
https://forums.gentoo.org/viewtopic-t-1092660.html
Comment 23 Till Schäfer 2019-06-21 13:45:17 UTC
I can confirm the crash on every start with akonadi_control 5.11.2:

Cannot remove old log file '%s': %s") at global/qlogging.cpp:887
Comment 24 Daniel Vrátil 2019-06-28 15:14:15 UTC
Git commit c21bb5220a3ae835a5183afd58c186ba21f6c93d by Daniel Vrátil.
Committed on 28/06/2019 at 15:13.
Pushed by dvratil into branch 'Applications/19.04'.

Fix race-condition on akonadi_control start

Summary:
Check that there are no other akonadi_control instances running as the
very first thing on startup. Previously this check would happen after
AkApplication initialization, which contains some potential race-
conditions, like rotating log files.

The situation when akonadi_control is launched multiple times can occur
on session startup, when multiple different components will attempt to
launch Akonadi if its not yet running.
FIXED-IN: 19.04.3

Reviewers: #kde_pim, vkrause

Reviewed By: #kde_pim, vkrause

Subscribers: kde-pim

Tags: #kde_pim

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

M  +2    -14   src/akonadicontrol/main.cpp
M  +3    -4    src/shared/akapplication.cpp
M  +43   -6    src/shared/akapplication.h

https://commits.kde.org/akonadi/c21bb5220a3ae835a5183afd58c186ba21f6c93d
Comment 25 Wolfgang Bauer 2019-07-07 17:32:11 UTC
*** Bug 409584 has been marked as a duplicate of this bug. ***