diff --git a/include/maxscale/routingworker.hh b/include/maxscale/routingworker.hh index ec6eaf629..a05fb3743 100644 --- a/include/maxscale/routingworker.hh +++ b/include/maxscale/routingworker.hh @@ -609,3 +609,11 @@ json_t* mxs_rworker_to_json(const char* host, int id); * @see mxs_json_resource() */ json_t* mxs_rworker_list_to_json(const char* host); + +/** + * @brief MaxScale worker watchdog + * + * If this function returns, then MaxScale is alive. If not, + * then some thread is dead. + */ +void mxs_rworker_watchdog(); diff --git a/server/core/resource.cc b/server/core/resource.cc index 3666db6f9..6a60680c5 100644 --- a/server/core/resource.cc +++ b/server/core/resource.cc @@ -900,6 +900,7 @@ HttpResponse cb_modulecmd(const HttpRequest& request) HttpResponse cb_send_ok(const HttpRequest& request) { + mxs_rworker_watchdog(); return HttpResponse(MHD_HTTP_OK); } diff --git a/server/core/routingworker.cc b/server/core/routingworker.cc index 4ca1eeb45..88a749fe0 100644 --- a/server/core/routingworker.cc +++ b/server/core/routingworker.cc @@ -1167,3 +1167,28 @@ json_t* mxs_rworker_list_to_json(const char* host) RoutingWorker::execute_concurrently(task); return task.resource(); } + +namespace +{ + +class WatchdogTask : public Worker::Task +{ +public: + WatchdogTask() + { + } + + void execute(Worker& worker) + { + // Success if this is called. + } +}; + +} + +void mxs_rworker_watchdog() +{ + MXS_INFO("MaxScale watchdog called."); + WatchdogTask task; + RoutingWorker::execute_concurrently(task); +}