Bug 393578

Summary: Broken thread use
Product: [Unmaintained] kactivitymanagerd Reporter: David Edmundson <kde>
Component: generalAssignee: Ivan Čukić <ivan.cukic>
Status: RESOLVED FIXED    
Severity: normal CC: plasma-bugs-null
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description David Edmundson 2018-04-27 14:59:53 UTC
The database is opened in the main thread.

ResourceScoreCache::update  runs in another thread. This is not supported and crashes all over the place. 

Database does seem to try and have a per thread thing, but debug shows it doesn't work and even if it did would be working around a problem that shouldn't exist in the first place.

We probably don't see many reports as kactivitymanagerd doesn't link KCrash.
Comment 1 Ivan Čukić 2018-04-27 19:20:30 UTC
Yes, the sqlite driver in Qt was changed not to serialize the database access. Will see what to do...
Comment 2 David Edmundson 2018-04-28 07:42:43 UTC
Didn't realise it was a recent change. Thats kinda good news. I'm on 5.11 beta here.

Personally I'd just drop the thread. Your events come from either dbus which has its own thread and queue, or the xcb qpa which has its own thread and queue. 
Even if the query takes ages it won't cause a noticable problem.

But we can do whatever. Let me know if I can help with anything.
Comment 3 Ivan Čukić 2018-04-28 11:10:42 UTC
Yes, they removed a flag they used to pass to sqlite which made sqlite behave well in a multi-threaded environment (was almost ready to fork the driver like akonadi ppl did when I heard this :) ). IIRC, it was in 5.10.

Anyhow: https://phabricator.kde.org/D12576
Comment 4 Christoph Feck 2018-05-17 01:07:16 UTC
Patch from comment #3 was committed. Did it resolve this issue?
Comment 5 David Edmundson 2018-05-17 01:18:23 UTC
yep