Properly catch and report dbus timeout exception
openbmc/phosphor-state-manager#4 tracks an intermittent issue that is
being hit in hardware CI. The root cause is not yet known but this
commit will help in two ways:
- Ensure the error is where it's thought to be in the call to systemd
- Capture a dump (via InternalFailure) when the error occurs
Tested:
Verified good path still works. I can't find a way to force the error
path (or recreate the issue).
Change-Id: Iffc946f376419ada1bd4ce7646060b081fedd065
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/chassis_state_manager.cpp b/chassis_state_manager.cpp
index 8fd56b8..8f1ce3b 100644
--- a/chassis_state_manager.cpp
+++ b/chassis_state_manager.cpp
@@ -49,9 +49,18 @@
void Chassis::subscribeToSystemdSignals()
{
- auto method = this->bus.new_method_call(SYSTEMD_SERVICE, SYSTEMD_OBJ_PATH,
- SYSTEMD_INTERFACE, "Subscribe");
- this->bus.call_noreply(method);
+ try
+ {
+ auto method = this->bus.new_method_call(
+ SYSTEMD_SERVICE, SYSTEMD_OBJ_PATH, SYSTEMD_INTERFACE, "Subscribe");
+ this->bus.call_noreply(method);
+ }
+ catch (const sdbusplus::exception::SdBusError& ex)
+ {
+ log<level::ERR>("Failed to subscribe to systemd signals",
+ entry("ERR=%s", ex.what()));
+ elog<InternalFailure>();
+ }
return;
}