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.
_______________________________________________
calendarserver-dev mailing list
calendarserver-dev@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/calendarserver-dev

Reply via email to