diff --git a/server/core/config_runtime.cc b/server/core/config_runtime.cc index 2d2f1f380..8e3aea3d4 100644 --- a/server/core/config_runtime.cc +++ b/server/core/config_runtime.cc @@ -841,11 +841,11 @@ bool runtime_create_monitor(const char *name, const char *module) if (monitor_find(name) == NULL) { - MXS_MONITOR *monitor = monitor_find_destroyed(name, module); + MXS_MONITOR *monitor = monitor_repurpose_destroyed(name, module); if (monitor) { - monitor->active = true; + MXS_DEBUG("Repurposed monitor '%s'", name); } else if ((monitor = monitor_alloc(name, module)) == NULL) { diff --git a/server/core/maxscale/monitor.h b/server/core/maxscale/monitor.h index 2bfc4d4e9..681ad602b 100644 --- a/server/core/maxscale/monitor.h +++ b/server/core/maxscale/monitor.h @@ -50,7 +50,7 @@ void monitorStopAll(); void monitorStartAll(); MXS_MONITOR *monitor_find(const char *); -MXS_MONITOR* monitor_find_destroyed(const char* name, const char* module); +MXS_MONITOR* monitor_repurpose_destroyed(const char* name, const char* module); void monitorShow(DCB *, MXS_MONITOR *); void monitorShowAll(DCB *); diff --git a/server/core/monitor.cc b/server/core/monitor.cc index 0ad7a974b..3276edd95 100644 --- a/server/core/monitor.cc +++ b/server/core/monitor.cc @@ -236,9 +236,9 @@ monitorStop(MXS_MONITOR *monitor) void monitorDestroy(MXS_MONITOR* monitor) { - spinlock_acquire(&monitor->lock); + spinlock_acquire(&monLock); monitor->active = false; - spinlock_release(&monitor->lock); + spinlock_release(&monLock); } /** @@ -574,7 +574,7 @@ monitor_find(const char *name) * @param name The name of the monitor * @return Pointer to the destroyed monitor or NULL if monitor is not found */ -MXS_MONITOR* monitor_find_destroyed(const char* name, const char* module) +MXS_MONITOR* monitor_repurpose_destroyed(const char* name, const char* module) { MXS_MONITOR* rval = NULL; @@ -584,6 +584,8 @@ MXS_MONITOR* monitor_find_destroyed(const char* name, const char* module) { if (strcmp(ptr->name, name) == 0 && strcmp(ptr->module_name, module) == 0) { + ss_dassert(!ptr->active); + ptr->active = true; rval = ptr; } }