[SSSD] [PATCH] test_memory_cache: Wait short time after cache invalidation

Michal Židek mzidek at redhat.com
Mon Aug 10 11:32:40 UTC 2015


On 08/10/2015 12:26 PM, Lukas Slebodnik wrote:
> On (10/08/15 10:41), Lukas Slebodnik wrote:
>> On (07/08/15 21:19), Michal Židek wrote:
>>> On 08/07/2015 06:16 AM, Lukas Slebodnik wrote:
>>>>
>>>> +def wait_till_nss_responder_invalidate_cache():
>>>> +    # 1 second (200 * 0.005) should be enough time for nss responder
>>>> +    for _ in range(1, 200):
>>>> +        if os.path.isfile(config.MCACHE_PATH + "/clear_mc_flag"):
>>>> +            time.sleep(.005)
>>>> +        else:
>>>> +            return
>>>> +
>>>> +    assert False, "nss responder didn't invalidate memory cache within second"
>>>
>>> Grammar nazi nitpick :) : Missing "a" -> within a second
>>> But the nitpick is not relevant due to the following:
>>>
>>> I would give it at least 5 seconds for 2 reasons:
>>> a) if it ends sooner nothing happens, everything is fine
>>> b) if it ends later (CI machine under heavy load
>>>    makes even this possible) it breaks the test.
>>>
>> I realized it might be better to implement it directly in the utility
>> sss_cache. I didn't increased time to 5 seconds because
>> It would be a long time for users
>> and they might to decide to cancel it (ctrl-c).
>>
> and now with patches
>
> LS
>

227
228         ret = wait_till_nss_responder_invalidate_cache();
229         if (ret != EOK) {
230             ERROR("The fast memory caches was...
231                   "responder.\n");
232         }
233     }

We should not ignore the error here. If the function
returns EAGAIN we should propagate EAGAIN to
sss_memcache_clear_all() caller and let him call
the sss_memcache_clear_all() again with limited
number of tries. My proposal is shortening the
max_wait to 500 000 with 10 retries).

The reason for returning EAGAIN may be NSS responder
not running anymore. In that case calling
sss_memcache_clear_all() again will properly remove
the memcache files. The reason for returning EAGAIN
multiple times might be probably just slow CI, some
bug or manually stopped NSS responder. All not standard
situations -> we can afford to wait, that is why I
proposed 10 retries.

Michal
-- 
Senior Principal Intern



More information about the sssd-devel mailing list