diff --git a/simgear/structure/subsystem_mgr.cxx b/simgear/structure/subsystem_mgr.cxx index a4ea8270..7497d7b1 100644 --- a/simgear/structure/subsystem_mgr.cxx +++ b/simgear/structure/subsystem_mgr.cxx @@ -30,9 +30,10 @@ #include "subsystem_mgr.hxx" #include "commands.hxx" -#include -#include #include "SGSmplstat.hxx" +#include +#include +#include const int SG_MAX_SUBSYSTEM_EXCEPTIONS = 4; const char SUBSYSTEM_NAME_SEPARATOR = '.'; @@ -828,8 +829,18 @@ SGSubsystemGroup::Member::update (double delta_time_sec) if (++exceptionCount > SG_MAX_SUBSYSTEM_EXCEPTIONS) { SG_LOG(SG_GENERAL, SG_ALERT, "(exceptionCount=" << exceptionCount << ", suspending)"); + simgear::reportError("suspending subsystem after too many errors:" + name); subsystem->suspend(); } + } catch (std::bad_alloc& ba) { + // attempting to track down source of these on Sentry.io + SG_LOG(SG_GENERAL, SG_ALERT, "caught bad_alloc processing subsystem:" << name); + simgear::reportError("caught bad_alloc processing subsystem:" + name); + + if (++exceptionCount > SG_MAX_SUBSYSTEM_EXCEPTIONS) { + SG_LOG(SG_GENERAL, SG_ALERT, "(exceptionCount=" << exceptionCount << ", suspending)"); + subsystem->suspend(); + } } }