PauseableTimer issue + suggested fix

Daniel Vrátil dvratil at kde.org
Fri Dec 16 10:11:36 GMT 2016


On Thursday, December 15, 2016 7:33:49 PM CET David Faure wrote:
> Hi Dan,

Hi David,

> 
> I was looking at why akonadiserver was outputting lots of warnings like
> Akonadi::Server::PauseableTimer::pause: Cannot pause an inactive timer
> 
> and I think I found why: it comes from the commit attached.
> 
> The queued connection for the calls to pause and resume means that
> the checks in inhibit(), like mScheduler->isActive() &&
> !mScheduler->isPaused() are not enough anymore since this change. A queued
> call to pause() might have been done and not handled yet, so this will
> create a second queued call, which will lead to the warning.
> In fact, if this code is indeed called from a different thread than the
> timer, like the commit log says, then there is a race condition on
> mScheduler's data members, read in the secondary thread (in inhibit()) and
> written in the main thread (where PauseableTimer lives, if the commit log
> is correct).
> 
> Wouldn't it make sense to just always make the queued calls, from inhibit(),
> and to move the checks for whether we have anything to change, inside pause
> and resume, i.e. early-return rather than warning, if there's nothing to
> do?
> This would fix the warning (by definition ;) and it would fix the race
> because the thread calling inhibit() wouldn't try to read anything from the
> thread where the timer lives.

Good catch. Thanks for looking into this, I pushed the fix you suggested to 
master and Applications/16.12 branches.

> 
> PS: I was looking at debug output because I'm experiencing much bigger
> problems with akonadi master, kolab resource not syncing the inbox
> sometimes, and an akonadiserver assert in QDataStream due to null
> QIODevice, but I need more data to give more precise bug reports and/or
> patches about this.

:( I'm not seeing any issues with Kolab here. If you have any backtrace of the 
server crash, just mail it to me.

Dan


-- 
Daniel Vrátil
www.dvratil.cz | dvratil at kde.org
IRC: dvratil on Freenode (#kde, #kontact, #akonadi, #fedora-kde)

GPG Key: 0x4D69557AECB13683
Fingerprint: 0ABD FA55 A4E6 BEA9 9A83 EA97 4D69 557A ECB1 3683
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20161216/ff7cdf5c/attachment.sig>


More information about the kde-pim mailing list