]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/mgr/stats: check if cmdtag is a valid key in client_metadata 42608/head
authorJos Collin <jcollin@redhat.com>
Tue, 3 Aug 2021 13:07:00 +0000 (18:37 +0530)
committerJos Collin <jcollin@redhat.com>
Thu, 5 Aug 2021 10:30:28 +0000 (16:00 +0530)
Invalid cmdtag values ('', foo) are found in random testing and in the
qa runs. So check if cmdtag is a valid key in client_metadata.

Fixes: https://tracker.ceph.com/issues/51975
Signed-off-by: Jos Collin <jcollin@redhat.com>
src/pybind/mgr/stats/fs/perf_stats.py

index 23b08cb44e8d414316ca83e1fb9b98299e4a3f22..09b82a23e22cca1d6ee441cf3fec383072381ab9 100644 (file)
@@ -126,7 +126,12 @@ class FSPerfStats(object):
     def notify(self, cmdtag):
         self.log.debug("cmdtag={0}".format(cmdtag))
         with self.meta_lock:
-            result = self.client_metadata['in_progress'].pop(cmdtag)
+            try:
+                result = self.client_metadata['in_progress'].pop(cmdtag)
+            except KeyError:
+                self.log.warn(f"cmdtag {cmdtag} not found in client metadata")
+                return
+
             client_meta = result[1].wait()
             if client_meta[0] != 0:
                 self.log.warn("failed to fetch client metadata from rank {0}, err={1}".format(