Add support for systemd service watchdog
Systemd has support for enabling service level watchdog. The MR enables
this support for bmcweb daemon. Request for watchdog monitor from
systemd is added in bmcweb.service.in. From the event loop a timer is
registered to kick the watchdog periodically
The default watchdog timeout is set at 120 seconds and the timer is set
to kick it at a quarter of the interval (every 30 seconds).
This timeout is set somewhat arbitrarily based on the longest blocking
call that could occur and still give a valid HTTP response. Suspect
lower values could work equally as well.
Benefits of Service Watchdog
- Bmcweb route handlers should not make any blocking IO calls which
block the event loop for considerable amount of time and slowdown the
response of other URI requests in the queue. Watchdog can help to detect
such issues.
- Watchdog can help restart the service if any route handler code has
uncaught bugs resulting from system API errors (this is in theory,
currently we don't have any use case).
Tested
1. UT is passing
2. Service validator is passing
3. Fw upgrade POST requests are working
Change-Id: If62397d8836c942fdcbc0618810fe82a8b248df8
Signed-off-by: rohitpai <ropai@nvidia.com>
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/config/meson.build b/config/meson.build
index 7a3e17d..e681a5f 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -50,7 +50,7 @@
'redfish-system-uri-name',
]
-int_options = ['http-body-limit']
+int_options = ['http-body-limit', 'watchdog-timeout-seconds']
feature_options_string = '\n//Feature options\n'
string_options_string = '\n// String options\n'
@@ -157,7 +157,10 @@
install_dir: systemd_system_unit_dir,
install: true,
configuration: configuration_data(
- {'MESON_INSTALL_PREFIX': get_option('prefix')},
+ {
+ 'MESON_INSTALL_PREFIX': get_option('prefix'),
+ 'WATCHDOG_TIMEOUT_SECONDS': get_option('watchdog-timeout-seconds'),
+ },
),
)