Bug 283615 - "Mimetype tree is not a DAG!" errors + crashes when using SMI 0.91
Summary: "Mimetype tree is not a DAG!" errors + crashes when using SMI 0.91
Status: VERIFIED FIXED
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: libakonadi (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
: 283436 283505 283751 283828 283833 283876 284453 284983 285307 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-10-08 18:05 UTC by Alin M Elena
Modified: 2011-10-30 14:14 UTC (History)
14 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.7.3


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alin M Elena 2011-10-08 18:05:39 UTC
Application: kontact (4.8 pre)
KDE Platform Version: 4.7.2 (4.7.2) "release 1"
Qt Version: 4.8.0
Operating System: Linux 3.1.0-rc7-3-desktop x86_64
Distribution: "openSUSE 12.1 Beta 1 (x86_64)"

-- Information about the crash:
I open an email...
right click on sender and try to add it to address book... 
voila le crash!

The crash can be reproduced every time.

-- Backtrace:
Application: Kontact (kontact), signal: Aborted
[Current thread is 1 (Thread 0x7f5d4d684760 (LWP 7275))]

Thread 5 (Thread 0x7f5d34e8b700 (LWP 7293)):
#0  0x00007f5d4503ee6c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f5d49e5c04c in WTF::TCMalloc_PageHeap::scavengerThread() () from /usr/lib64/libQtWebKit.so.4
#2  0x00007f5d49e5c179 in WTF::TCMalloc_PageHeap::runScavengerThread(void*) () from /usr/lib64/libQtWebKit.so.4
#3  0x00007f5d4503af05 in start_thread () from /lib64/libpthread.so.0
#4  0x00007f5d4ab9924d in clone () from /lib64/libc.so.6

Thread 4 (Thread 0x7f5d3458a700 (LWP 7294)):
#0  0x00007f5d4b305978 in QEventDispatcherGlib::processEvents (this=0x831b70, flags=<optimized out>) at kernel/qeventdispatcher_glib.cpp:425
#1  0x00007f5d4b2d5722 in QEventLoop::processEvents (this=<optimized out>, flags=...) at kernel/qeventloop.cpp:149
#2  0x00007f5d4b2d5977 in QEventLoop::exec (this=0x7f5d34589e20, flags=...) at kernel/qeventloop.cpp:204
#3  0x00007f5d4b1d70b7 in QThread::exec (this=<optimized out>) at thread/qthread.cpp:501
#4  0x00007f5d4b1da0db in QThreadPrivate::start (arg=0x63ed70) at thread/qthread_unix.cpp:298
#5  0x00007f5d4503af05 in start_thread () from /lib64/libpthread.so.0
#6  0x00007f5d4ab9924d in clone () from /lib64/libc.so.6

Thread 3 (Thread 0x7f5ce32fa700 (LWP 9943)):
#0  0x00007f5d4503f1eb in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f5d4b1da54f in wait (time=30000, this=0xd2fe50) at thread/qwaitcondition_unix.cpp:84
#2  QWaitCondition::wait (this=<optimized out>, mutex=0xd2fdb8, time=30000) at thread/qwaitcondition_unix.cpp:158
#3  0x00007f5d4b1cd95f in QThreadPoolThread::run (this=0xd3d370) at concurrent/qthreadpool.cpp:141
#4  0x00007f5d4b1da0db in QThreadPrivate::start (arg=0xd3d370) at thread/qthread_unix.cpp:298
#5  0x00007f5d4503af05 in start_thread () from /lib64/libpthread.so.0
#6  0x00007f5d4ab9924d in clone () from /lib64/libc.so.6

Thread 2 (Thread 0x7f5ceca07700 (LWP 9987)):
#0  0x00007f5d4503f1eb in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f5d4b1da54f in wait (time=30000, this=0x2a4f1e0) at thread/qwaitcondition_unix.cpp:84
#2  QWaitCondition::wait (this=<optimized out>, mutex=0x2af7b28, time=30000) at thread/qwaitcondition_unix.cpp:158
#3  0x00007f5d4b1cd95f in QThreadPoolThread::run (this=0x1bd0cc0) at concurrent/qthreadpool.cpp:141
#4  0x00007f5d4b1da0db in QThreadPrivate::start (arg=0x1bd0cc0) at thread/qthread_unix.cpp:298
#5  0x00007f5d4503af05 in start_thread () from /lib64/libpthread.so.0
#6  0x00007f5d4ab9924d in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7f5d4d684760 (LWP 7275)):
[KCrash Handler]
#6  0x00007f5d4aaf4d25 in raise () from /lib64/libc.so.6
#7  0x00007f5d4aaf623b in abort () from /lib64/libc.so.6
#8  0x00007f5d4af0cead in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib64/libstdc++.so.6
#9  0x00007f5d4af0b056 in ?? () from /usr/lib64/libstdc++.so.6
#10 0x00007f5d4af0b083 in std::terminate() () from /usr/lib64/libstdc++.so.6
#11 0x00007f5d4af0b1c6 in __cxa_rethrow () from /usr/lib64/libstdc++.so.6
#12 0x00007f5d4b2d5c0c in QEventLoop::exec (this=<optimized out>, flags=<optimized out>) at kernel/qeventloop.cpp:218
#13 0x00007f5d4b2da4d5 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1148
#14 0x0000000000403919 in main (argc=3, argv=0x7fffcec15458) at /usr/src/debug/kdepim-4.7.43_20111007/kontact/src/main.cpp:218

Possible duplicates by query: bug 283593, bug 283581, bug 283565, bug 283545, bug 283527.

Reported using DrKonqi
Comment 1 Christophe Marin 2011-10-11 09:24:51 UTC
Seems to be an OpenSuse regression in their 12.1 release. The origin isn't identified yet.
Comment 2 Christophe Marin 2011-10-11 23:05:16 UTC
ok, the cause was found by Andrea Scarpino.

Downgrading shared-mime-info from 0.91 to 0.90 fixes the bug immediately.

Adding David.
Comment 3 Christophe Marin 2011-10-11 23:05:26 UTC
*** Bug 283436 has been marked as a duplicate of this bug. ***
Comment 4 Christophe Marin 2011-10-11 23:05:47 UTC
*** Bug 283828 has been marked as a duplicate of this bug. ***
Comment 5 Andrea Scarpino 2011-10-11 23:09:10 UTC
I reported this upstream https://bugs.freedesktop.org/show_bug.cgi?id=41701
Comment 6 Christophe Marin 2011-10-11 23:47:26 UTC
After bisecting the SMI repo, this commit is the one causing this bug:

b465cec3db4056f6871ce3d5ab97d987c3f7799f is the first bad commit
commit b465cec3db4056f6871ce3d5ab97d987c3f7799f
Author: Ville Skyttä <ville.skytta@iki.fi>
Date:   Sat Jun 18 22:20:00 2011 +0300

    Use text/vcard instead of deprecated text/directory for vCards.

:100644 100644 4802c8fcbda96994b5ac8747e88db5e5757ff085 92d5c6c187caeffc2a62b96ffc090c9a75fb2c6d M      freedesktop.org.xml.in
:040000 040000 1788265ab6e0a09da25eaf2dcd8646dc8469551e 5a9a63836b373be9606fd72bdd8c754760f3f791 M      tests
Comment 7 Will Stephenson 2011-10-12 07:05:48 UTC
So is the aliasing of text/vcard to text/directory in KMimeType failing?

Christophe, do you know if the not a DAG results from some type that we are looking for being disconnected from text/vcard?  I couldn't find any mimetypes that directly inherit text/directory in the kde mimetype xml in /usr/share/mime.

renamed text/directory, added alias:
http://cgit.freedesktop.org/xdg/shared-mime-info/commit/?id=b465cec3db4056f6871ce3d5ab97d987c3f7799f

failing function:
http://lxr.kde.org/source/kde/kdepimlibs/akonadi/typepluginloader.cpp#289
Comment 8 Grégory Oestreicher 2011-10-12 07:17:56 UTC
*** Bug 283833 has been marked as a duplicate of this bug. ***
Comment 9 Christophe Marin 2011-10-12 09:55:09 UTC
Found the workaround for 0.91:

kaddressbook(10595)/libkdepim Akonadi::PluginLoader::scan: registering Desktop file "/kde/inst/kdepim-runtime/share/apps/akonadi/plugins/serializer/akonadi_serializer_addressee.desktop" for ("text/vcard", "text/directory") @ ("legacy", "default", "KABC::Addressee")

removing text/directory from the types declared in this desktop file fixes the issue with SMI 0.91 but obviously breaks with 0.90


(in kdepim-runtime)

diff --git a/plugins/akonadi_serializer_addressee.desktop b/plugins/akonadi_serializer_addressee.desktop
index 1e4205a..7b8a5a4 100644
--- a/plugins/akonadi_serializer_addressee.desktop
+++ b/plugins/akonadi_serializer_addressee.desktop
@@ -89,7 +89,7 @@ Comment[zh_CN]=对收信人对象进行序列转换的 Akonadi 插件
 Comment[zh_TW]=地址物件的 Akonadi 序列器外掛程式
 
 [Plugin]
-Type=text/vcard,text/directory
+Type=text/vcard
 X-Akonadi-Class=legacy;default;KABC::Addressee;
 X-KDE-Library=akonadi_serializer_addressee
 X-KDE-ClassName=Akonadi::SerializerPluginAddressee
Comment 10 Andrea Scarpino 2011-10-12 10:02:39 UTC
(In reply to comment #9)
> removing text/directory from the types declared in this desktop file fixes the
> issue with SMI 0.91 but obviously breaks with 0.90
Confirmed. Great! Can we apply this patch in our packages?
Comment 11 Christophe Marin 2011-10-12 10:24:10 UTC
Not sure. Looks like removing text/vcard gives better results with both versions.

Please test with all kinds of resources providing contacts (vcard, contacts directory, akonadi-google * 2, kolab, dav, akonadi-facebook...)
Comment 12 Will Stephenson 2011-10-12 11:05:34 UTC
Debug output from TypePluginLoader's findBestMatchImpl () function:
(on saving a new contact in kaddressbook):


kaddressbook(10184)/kdecore (KSycoca) KSycocaPrivate::openDatabase: Trying to open ksycoca from "/var/tmp/kdecache-testuser/ksycoca4"
kaddressbook(10184)/libkdepim Akonadi::PluginLoader::scan: registering Desktop file "/home/space/kde/installs/48/share/apps/akonadi/plugins/serializer/akonadi_serializer_kalarm.desktop" for ("application/x-vnd.kde.alarm", "application/x-vnd.kde.alarm.active", "application/x-vnd.kde.alarm.archived", "application/x-vnd.kde.alarm.template") @ ("default", "KAEvent")
kaddressbook(10184)/libkdepim Akonadi::PluginLoader::scan: registering Desktop file "/home/space/kde/installs/48/share/apps/akonadi/plugins/serializer/akonadi_serializer_bookmark.desktop" for ("application/x-xbel") @ ("legacy", "default", "KBookmark")
kaddressbook(10184)/libkdepim Akonadi::PluginLoader::scan: registering Desktop file "/home/space/kde/installs/48/share/apps/akonadi/plugins/serializer/akonadi_serializer_addressee.desktop" for ("text/vcard", "text/directory") @ ("legacy", "default", "KABC::Addressee")
kaddressbook(10184)/libkdepim Akonadi::PluginLoader::scan: registering Desktop file "/home/space/kde/installs/48/share/apps/akonadi/plugins/serializer/akonadi_serializer_kcalcore.desktop" for ("text/calendar", "application/x-vnd.akonadi.note", "application/x-vnd.kde.notes") @ ("default", "KCalCore::Incidence*")
kaddressbook(10184)/libkdepim Akonadi::PluginLoader::scan: registering Desktop file "/home/space/kde/installs/48/share/apps/akonadi/plugins/serializer/akonadi_serializer_microblog.desktop" for ("application/x-vnd.kde.microblog") @ ("legacy", "default", "Microblog::StatusItem")
kaddressbook(10184)/libkdepim Akonadi::PluginLoader::scan: registering Desktop file "/home/space/kde/installs/48/share/apps/akonadi/plugins/serializer/akonadi_serializer_contactgroup.desktop" for ("application/x-vnd.kde.contactgroup") @ ("legacy", "default", "KABC::ContactGroup")
kaddressbook(10184)/libkdepim Akonadi::PluginLoader::scan: registering Desktop file "/home/space/kde/installs/48/share/apps/akonadi/plugins/serializer/akonadi_serializer_kcal.desktop" for ("text/calendar", "application/x-vnd.akonadi.note", "application/x-vnd.kde.notes") @ ("legacy", "KCal::Incidence*")
kaddressbook(10184)/libkdepim Akonadi::PluginLoader::scan: registering Desktop file "/home/space/kde/installs/48/share/apps/akonadi/plugins/serializer/akonadi_serializer_mail.desktop" for ("message/rfc822", "message/news", "text/x-vnd.akonadi.note") @ ("legacy", "default", "KMime::Message*")
kaddressbook(10184)/libakonadi Akonadi::PluginRegistry::PluginRegistry: ItemSerializerPluginLoader:  found 44 plugins.
kaddressbook(10184)/libakonadi Akonadi::PluginRegistry::findBestMatchImpl: searching for type plugin for "text/directory"
kaddressbook(10184)/libakonadi Akonadi::PluginRegistry::findBestMatchImpl: "text/vcard" matches: "application/octet-stream"
kaddressbook(10184)/libakonadi Akonadi::PluginRegistry::findBestMatchImpl: "text/vcard" matches: "text/directory"
kaddressbook(10184)/libakonadi Akonadi::PluginRegistry::findBestMatchImpl: "text/vcard" matches: "text/vcard"
kaddressbook(10184)/libakonadi Akonadi::PluginRegistry::findBestMatchImpl: adding "text/vcard" to graph
kaddressbook(10184)/libakonadi Akonadi::PluginRegistry::findBestMatchImpl: adding "text/vcard" to graph
kaddressbook(10184)/libakonadi Akonadi::PluginRegistry::findBestMatchImpl: adding "text/vcard" to graph
kaddressbook(10184)/libakonadi Akonadi::PluginRegistry::findBestMatchImpl: adding "text/vcard" to graph
kaddressbook(10184)/libakonadi Akonadi::PluginRegistry::findBestMatchImpl: trying topo sort
kaddressbook(10184)/libakonadi Akonadi::PluginRegistry::findBestMatchImpl: Mimetype tree is not a DAG! 
kaddressbook(10184)/libakonadi Akonadi::PluginRegistry::findBestMatchImpl: searching for type plugin for "text/directory"
kaddressbook(10184)/libakonadi Akonadi::PluginRegistry::findBestMatchImpl: "text/vcard" matches: "application/octet-stream"
kaddressbook(10184)/libakonadi Akonadi::PluginRegistry::findBestMatchImpl: "text/vcard" matches: "text/directory"
kaddressbook(10184)/libakonadi Akonadi::PluginRegistry::findBestMatchImpl: "text/vcard" matches: "text/vcard"
kaddressbook(10184)/libakonadi Akonadi::PluginRegistry::findBestMatchImpl: adding "text/vcard" to graph
kaddressbook(10184)/libakonadi Akonadi::PluginRegistry::findBestMatchImpl: adding "text/vcard" to graph
kaddressbook(10184)/libakonadi Akonadi::PluginRegistry::findBestMatchImpl: adding "text/vcard" to graph
kaddressbook(10184)/libakonadi Akonadi::PluginRegistry::findBestMatchImpl: adding "text/vcard" to graph
kaddressbook(10184)/libakonadi Akonadi::PluginRegistry::findBestMatchImpl: trying topo sort
kaddressbook(10184)/libakonadi Akonadi::PluginRegistry::findBestMatchImpl: Mimetype tree is not a DAG! 
kaddressbook(10184)/libakonadi Akonadi::PluginRegistry::findBestMatchImpl: searching for type plugin for "text/directory"
kaddressbook(10184)/libakonadi Akonadi::PluginRegistry::findBestMatchImpl: "text/vcard" matches: "application/octet-stream"
kaddressbook(10184)/libakonadi Akonadi::PluginRegistry::findBestMatchImpl: "text/vcard" matches: "text/directory"
kaddressbook(10184)/libakonadi Akonadi::PluginRegistry::findBestMatchImpl: "text/vcard" matches: "text/vcard"
kaddressbook(10184)/libakonadi Akonadi::PluginRegistry::findBestMatchImpl: adding "text/vcard" to graph
kaddressbook(10184)/libakonadi Akonadi::PluginRegistry::findBestMatchImpl: adding "text/vcard" to graph
kaddressbook(10184)/libakonadi Akonadi::PluginRegistry::findBestMatchImpl: adding "text/vcard" to graph
kaddressbook(10184)/libakonadi Akonadi::PluginRegistry::findBestMatchImpl: adding "text/vcard" to graph
kaddressbook(10184)/libakonadi Akonadi::PluginRegistry::findBestMatchImpl: trying topo sort
kaddressbook(10184)/libakonadi Akonadi::PluginRegistry::findBestMatchImpl: Mimetype tree is not a DAG! 
Qt has caught an exception thrown from an event handler. Throwing
exceptions from an event handler is not supported in Qt. You must
reimplement QApplication::notify() and catch all exceptions there.

terminate called after throwing an instance of 'Akonadi::PayloadException'
  what():  Akonadi::PayloadException: Wrong payload type (requested: sp(0)<QByteArray>; present: sp(0)<KABC::Addressee>
KCrash: Application 'kaddressbook' crashing...
K
Comment 13 Christophe Marin 2011-10-12 11:43:46 UTC
you need to re-run kbuildsycoca4 --noincremental after up/downgrading smi or changing the desktop file
Comment 14 Christophe Marin 2011-10-12 21:14:31 UTC
*** Bug 283876 has been marked as a duplicate of this bug. ***
Comment 15 Christophe Marin 2011-10-13 07:43:46 UTC
*** Bug 283751 has been marked as a duplicate of this bug. ***
Comment 16 Will Stephenson 2011-10-13 08:58:43 UTC
Volker, please can you have a look at this soon?  Hacking the types in the plugin's desktop file is only postponing the problem.
Comment 17 Christophe Marin 2011-10-13 17:35:47 UTC
*** Bug 283505 has been marked as a duplicate of this bug. ***
Comment 18 David Faure 2011-10-16 09:01:16 UTC
That code is resolving aliases everywhere, except in the list of mimetypes that it initially gets from the pluginloader (i.e. from the .desktop file I assume).

Does this patch help?
 http://www.davidfaure.fr/2011/typepluginloader.cpp.diff

(can't test it myself, currently setting up my new home computer for kde development)
Comment 19 Christophe Marin 2011-10-16 11:01:39 UTC
Yes, no crash with your patch and 0.91
Comment 20 David Faure 2011-10-16 15:15:07 UTC
Git commit e86bd47521fffd2d28d048c7d8ab6c4e6a4d909a by David Faure.
Committed on 16/10/2011 at 17:13.
Pushed by dfaure into branch 'master'.

Resolve alias read from the desktop file too.

Fixes a crash with shared-mime-info 0.91 where text/directory
was replaced with text/vcard (which was made an alias).
BUG: 283615
FIXED-IN: 4.7.3

M  +9    -6    akonadi/typepluginloader.cpp

http://commits.kde.org/kdepimlibs/e86bd47521fffd2d28d048c7d8ab6c4e6a4d909a
Comment 21 David Faure 2011-10-17 08:33:40 UTC
Git commit 70197a817da44ff406e52ea0dd8ba3b2416c3097 by David Faure.
Committed on 16/10/2011 at 17:13.
Pushed by dfaure into branch 'KDE/4.7'.

Resolve alias read from the desktop file too.

Fixes a crash with shared-mime-info 0.91 where text/directory
was replaced with text/vcard (which was made an alias).
BUG: 283615
FIXED-IN: 4.7.3
(cherry picked from commit e86bd47521fffd2d28d048c7d8ab6c4e6a4d909a)

M  +9    -6    akonadi/typepluginloader.cpp

http://commits.kde.org/kdepimlibs/70197a817da44ff406e52ea0dd8ba3b2416c3097
Comment 22 Will Stephenson 2011-10-17 10:23:04 UTC
Fixed, have added the patch to openSUSE packages.
Comment 23 Christophe Marin 2011-10-19 15:15:19 UTC
*** Bug 284453 has been marked as a duplicate of this bug. ***
Comment 24 Will Stephenson 2011-10-29 08:23:38 UTC
Downstream report: https://bugzilla.novell.com/show_bug.cgi?id=725243
Comment 25 Christophe Marin 2011-10-29 14:04:01 UTC
*** Bug 284983 has been marked as a duplicate of this bug. ***
Comment 26 Christophe Marin 2011-10-30 14:14:26 UTC
*** Bug 285307 has been marked as a duplicate of this bug. ***