Sometimes I see the error "AH01323: Purge of LDAP cache failed" repeated many times. Only restarting the HTTPD could stop it. After some investigation I think the marktime set when the cache is 3/4 full is the problem: If we have a cache with a short TTL-time many entries are renewed before the maxentries are reached. If the purge-run could only delete less than 1/4 of the entries (cause more than 1/2 are renewed meanwhile) we don't pass the place where the marktime is set again. After this we could not add any new item into the cache. Any try to add an item will cause the error "AH01323: Purge of LDAP cache failed".
Created attachment 35608 [details] mod_ldap TTL patch We have a TTL-time for each cache. So why don't use it for recalculating the best marktime before purging.
A small example to make the issue more clear: Imagine we have a cache that could store 20 items -> maxentries=20 and the TTL for the items is 10 seconds. markentries = maxentries*3/4 = 15 We have 11 power users sending a request every 5 seconds We have 20 lazy users sending a request once a minute (average 1 per 5 seconds) We start with an empty cache at 0 sec at 5 sec 12 items a taken (11 power + 1 lazy) at 20 sec 15 items a taken (11 power + 4 lazy) -> markentries reatched -> set marktime = 20 at 45 sec 20 items a taken (11 power + 9 lazy) at 50 sec a new lazy entry should be added into the cache but cache is full -> a purge starts The purge could only delete the 4 lazy entries older than marktime cause the power entries are already renewed. (TTL=10) So we left with 16 entries in our cache. 16 is greater than 15 ! So we never set a new marktime and all following purges could not delete any item. -> bang -> AH01323
Thank for the report, patch, and followup (it helped). I committed the patch with minor changes r1818040 and have proposed it for backport to 2.4.x.
Backported in 2.4.x in r1820800 This is part of 2.4.30
released with 2.4.33 - THX