Closed stephenxs closed 2 years ago
This kind of cached files should be cleared during config reload
.
The bug is also valid for ACL/PBH counters:
I see that for some counters (e.g dropstat) the cache file is cleared on config reload, code. This has to be done for every counter cache file, however there is another issue, e.g swss restart due to a crash, counters cache isn't cleared.
To solve this I propose:
UserCache
class that provides a per-application, per-user directory in a global cache directory (e.g /tmp/cache/portstat/1000/
, where 1000 is an UID of a user). Every stats application uses this API.@stepanblyschak how about /var/cache/sonic/
path?
Description
Steps to reproduce the issue:
However, for root user the output is:
We observe the issue on 202012 but I think it should be reproduced on other branches as well.
Describe the results you received:
In
portstat
in step 5, all counter contains 0, which is wrong since traffic has been sent.Describe the results you expected:
In
portstat
in step 5, counters should contain the correct value.Output of
show version
:Output of
show techsupport
:Additional information you deem important (e.g. issue happens only occasionally):
In SONiC, the utilities like "portstat" show counter on a per-user basis especially after a user clears the counters.
It works like this: if a user clears counters, it caches the current values fetched from COUNTER_DB in the /tmp/ folder. Each time it is executed, it fetches the counters from COUNTER_DB, and then compares them with the cache, and then displays the difference. Eg. the cached counter is 10, and the counter in COUNTER_DB is 15, it will display 5 which is 15 - 10. However, when a user executes "config reload", the COUNTER_DB will be zeroed, which means the cached counter will be greater than the one fetched from COUNTER_DB. After that, the utilities can give wrong data.
sonic_dump_arc-mtbc-1001_20220120_151843.tar.gz