Review Request 111718: Prevent EntityListCache from causing endless loop

Commit Hook null at kde.org
Sat Jul 27 12:04:23 UTC 2013


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/111718/
-----------------------------------------------------------

(Updated July 27, 2013, 12:04 p.m.)


Status
------

This change has been marked as submitted.


Review request for KDEPIM-Libraries and Release Team.


Description
-------

Calling ensureCached() can cause the cache and Monitor to end up in an endless loop.

In situation, that there are items 1,2,4,5 and 6 in the cache, calling ensureCached(1,2,3,4,5) will call request(3) and return false. request() internally calls shrinkCache() which removes all fetched items to make sure the cache does not grow indefinitely. After the item 3 is fetched, we end up with cache with only item 3. Monitor will then again call ensureCached(1,2,3,4,5), which will call request(1,2,4,5) which in return calls shrinkCache(), which will remove the item 3 and after fetched is finished the cache only contains items 1,2,4 and 5. This way the cache ends up in an endless loop because it will never contain all items that Monitor requested.

This patch prevents shrinkCache() from removing items that are part of the ensureCached() request.

I would like to get this patch to 4.11, because it's not that difficult to trigger this bug and in such case you end up with Akonadi resource going nuts (and not processing any further requests)


This implementation is still not optimal, because meanwhile the Monitor can call ensureCached(7,8,9), which will cause (1,2,4,5) to be removed from cache anyway, so it can take several tries for EntityListCache to retrieve the entire set (1,2,3,4,5). However now it's guaranteed that at some point the cache will succeed. We can rethink (and maybe remove) the cache when server-side recording is implemented.


Diffs
-----

  akonadi/entitycache_p.h 5f00917 

Diff: http://git.reviewboard.kde.org/r/111718/diff/


Testing
-------


Thanks,

Dan Vrátil

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/release-team/attachments/20130727/41c0c120/attachment.html>


More information about the release-team mailing list