[Nepomuk] Thread-safety of Nepomuk::Resource[Data|Watcher]

Volker Krause vkrause at kde.org
Sat Mar 10 10:51:17 UTC 2012


Hi,

I'm debugging a very frequent KMail crash I'm seeing since a few days, related 
to usage of Nepomuk from multiple threads (code is here: 
kdepim/messagecore/asyncnepomukresourceretriever.cpp). If it's because of 
recent changes in Nepomuk or due to the fact that I now have a production-size 
Nepomuk database with the Akonadi feeder finally working, I don't really know, 
but I think I found the cause :)

Nepomuk::Resource is documented to be thread-safe, and the implementation 
looks like great care has been taken to ensure it really is. Same for 
ResourceData. Not so ResourceWatcher, it has no internal locks and it uses a 
D-Bus connection bound to the main thread. Since mid-January ResourceData uses 
ResourceWatcher internally though, effectively breaking the thread-safety 
guarantee of Resource.

I have now commented out the ResourceWatcher usage in ResourceData locally, no 
more crashes so far, which seems to confirm the analysis above.

How do we fix this best? Moving the ResourceWatcher instance to the main 
thread and using queued connections to communicate with it in both directions?

regards,
Volker

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/nepomuk/attachments/20120310/f79b7676/attachment.sig>


More information about the Nepomuk mailing list