Review Request 111718: Prevent EntityListCache from causing endless loop

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

This is an automatically generated e-mail. To reply, visit:

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


This change has been marked as submitted.

Review request for KDEPIM-Libraries and Release Team.


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.


  akonadi/entitycache_p.h 5f00917 




Dan Vrátil

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the release-team mailing list