[CalendarServer-dev] Problem when purging an account

Kristoffer =?utf-8?Q?M=C3=B8llerh=C3=B8?=j kmo at b-one.net
Thu Oct 26 05:49:15 PDT 2017


I have observed a problem when purging an account. It is probably related to a bug in query caching.

When purging an account using the command line tool, sometimes the subsequent PrincipalPurgeHomeWork is failing silently and is not rescheduled. The result is that the purged account is left in a row in the calendar_home table and is never removed.

When debugging the problem, I found the following test on home.purging() to return false, even though the corresponding home was actually correctly purged at that time, and the status in the database was set to 2 ('purging') :

<https://github.com/apple/ccs-calendarserver/blob/master/calendarserver/tools/purge.py#L269>

Looking at the place where a calendar home is looked up:

<https://github.com/apple/ccs-calendarserver/blob/master/txdav/common/datastore/sql.py#L1745>

, it seems that a cachekey including the word 'None' is generated in the cases where the method homeWith is called with an undefined status paramter.

However, looking at the place where the status of a home is changed from 'normal' to 'purging':

<https://github.com/apple/ccs-calendarserver/blob/master/txdav/common/datastore/sql.py#L1978>

, it seems that only a cachekey having status 0 ('normal') is deleted. This means that next time homeWith(...) is called with status = None, the corresponding cachekey might still exist. Therefore, an old value of the calendar home, having status set to 'normal', could be returned.

I should mention that my debugging has been done in the ccs-calendarserver v.7.0 codebase. However looking at the newest code (pointed to by the links above), the bug still seems to exist.

Best regards,

Kristoffer Møllerhøj.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-dev/attachments/20171026/520420b2/attachment.html>


More information about the calendarserver-dev mailing list