From 6a8b5d8425cc8dd2923705dbc94974ecfa8dac31 Mon Sep 17 00:00:00 2001 From: Noah Watkins Date: Sun, 15 Jul 2018 13:02:58 -0700 Subject: [PATCH] mgr: ignore modules that fail to instantiate If an uncaught runtime exception occurs in a module constructor, then the manager still tries to deliver notifications resulting in errors like: src/mgr/ActivePyModule.cc: 54: FAILED assert(pClassInstance != nullptr) This removes the failed module from the set of active modules that should receive command and notifications. This also serves as a basis for accurately determining if the manager satisifes all "always on" module constraints. Signed-off-by: Noah Watkins --- src/mgr/ActivePyModules.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mgr/ActivePyModules.cc b/src/mgr/ActivePyModules.cc index 46a0f0a6c753..8ffa7fe2ea66 100644 --- a/src/mgr/ActivePyModules.cc +++ b/src/mgr/ActivePyModules.cc @@ -386,6 +386,9 @@ int ActivePyModules::start_one(PyModuleRef py_module) int r = active_module->load(this); if (r != 0) { + // the class instance wasn't created... remove it from the set of activated + // modules so commands and notifications aren't delivered. + modules.erase(py_module->get_name()); return r; } else { dout(4) << "Starting thread for " << py_module->get_name() << dendl; -- 2.47.3