Skip to content

Commit

Permalink
Merge pull request #269 from DUNE-DAQ/mroda/get_info_protections
Browse files Browse the repository at this point in the history
Protect from disasters while gather_stats
  • Loading branch information
bieryAtFnal authored Feb 8, 2024
2 parents ebbfd26 + 6faeffc commit b83b350
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
14 changes: 14 additions & 0 deletions src/DAQModuleManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@ ERS_DECLARE_ISSUE(appfwk,
((std::string)cmdid) ///< Message parameters
((std::string)modules) ///< Message parameters
)

ERS_DECLARE_ISSUE(appfwk, ///< Namespace
FailedInfoGathering, ///< Issue class name
"Info gathering failed for module: " << module, ///< Message
((std::string)module) ///< Message parameters
)

ERS_DECLARE_ISSUE_BASE(appfwk, ///< Namespace
ExceptionWhileInfoGathering, ///< Issue class name
FailedInfoGathering, ///< Base Issue class name
module << " threw exception while info gathering: " << message, ///< Message
((std::string)module), ///< Base Issue params
((std::string)message) ///< This class params
)
// Re-enable coverage collection LCOV_EXCL_STOP

namespace appfwk {
Expand Down
19 changes: 15 additions & 4 deletions src/detail/DAQModuleManager.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,21 @@ DAQModuleManager::gather_stats(opmonlib::InfoCollector& ci, int level)
iomanager::NetworkManager::get().gather_stats(ci, level);

for (const auto& [mod_name, mod_ptr] : m_module_map) {
opmonlib::InfoCollector tmp_ci;
mod_ptr->get_info(tmp_ci, level);
if (!tmp_ci.is_empty()) {
ci.add(mod_name, tmp_ci);
try {
opmonlib::InfoCollector tmp_ci;
mod_ptr->get_info(tmp_ci, level);
if (!tmp_ci.is_empty()) {
ci.add(mod_name, tmp_ci);
}
}
catch( ers::Issue & i ) {
ers::warning( FailedInfoGathering(ERS_HERE, mod_name, i) );
}
catch( std::exception & ex ) {
ers::warning( ExceptionWhileInfoGathering(ERS_HERE, mod_name, ex.what()) );
}
catch( ... ) {
ers::warning( FailedInfoGathering(ERS_HERE, mod_name) );
}
}
}
Expand Down

0 comments on commit b83b350

Please sign in to comment.