From 0077cb990dd6ea11fbed86be6e7449d8f035e2d0 Mon Sep 17 00:00:00 2001 From: Avan Thakkar Date: Wed, 24 Jun 2026 16:45:51 +0530 Subject: [PATCH] mgr: fix MgrModuleRecoverDB to honor its retry budget on db cleanup failure Both close_db() and open_db() during retry were unguarded, so a failure in either escaped the decorator immediately instead of retrying up to MAX_DBCLEANUP_RETRIES. Wrapped both in the same try/except, and logged the failed attempt. Fixes: https://tracker.ceph.com/issues/77635 Signed-off-by: Avan Thakkar --- src/pybind/mgr/mgr_module.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/mgr_module.py b/src/pybind/mgr/mgr_module.py index 192eefbf96e..3ba6cb3277c 100644 --- a/src/pybind/mgr/mgr_module.py +++ b/src/pybind/mgr/mgr_module.py @@ -619,8 +619,13 @@ def MgrModuleRecoverDB(func: Callable) -> Callable: if retries > MAX_DBCLEANUP_RETRIES: raise self.log.debug("attempting reopen of database") - self.close_db() - self.open_db() + try: + self.close_db() + self.open_db() + except sqlite3.DatabaseError as e2: + self.log.warning( + f"reopen attempt {retries}/{MAX_DBCLEANUP_RETRIES} failed: {e2}" + ) # allow retry of func(...) check.__signature__ = inspect.signature(func) # type: ignore[attr-defined] return check -- 2.47.3