From: Arthur de Kerhor Date: Thu, 24 Jun 2021 17:39:44 +0000 (+0200) Subject: stats: fix race conditions in vpp-api stats client X-Git-Tag: v21.06~4 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=e19fef7c88c79b7d0dfc9d7dcd2d271a39696143;p=vpp.git stats: fix race conditions in vpp-api stats client Type: fix Signed-off-by: Arthur de Kerhor Signed-off-by: Dave Wallace Change-Id: Ie5c197f6ec0d41d5e405b22662701d83ad94d29e (cherry picked from commit c9ae8cfaccd75fbc2dc27bdebccdbd14fc0cb60c) --- diff --git a/src/vpp-api/python/vpp_papi/vpp_stats.py b/src/vpp-api/python/vpp_papi/vpp_stats.py index 884a30019f8..376eb8cdfa2 100755 --- a/src/vpp-api/python/vpp_papi/vpp_stats.py +++ b/src/vpp-api/python/vpp_papi/vpp_stats.py @@ -187,12 +187,12 @@ class VPPStats(): while True: try: with self.lock: + self.last_epoch = self.epoch for i, direntry in enumerate(StatsVector(self, self.directory_vector, self.elementfmt)): path_raw = direntry[2].find(b'\x00') path = direntry[2][:path_raw].decode('ascii') directory[path] = StatsEntry(direntry[0], direntry[1]) directory_by_idx[i] = path - self.last_epoch = self.epoch self.directory = directory self.directory_by_idx = directory_by_idx