Browse Source

Fix crash during shutdown of cgroups internal plugin. (#10614)

Markos Fountoulakis 4 years ago
parent
commit
9ba79d3a1a
1 changed files with 2 additions and 1 deletions
  1. 2 1
      collectors/cgroups.plugin/sys_fs_cgroup.c

+ 2 - 1
collectors/cgroups.plugin/sys_fs_cgroup.c

@@ -3937,9 +3937,10 @@ static void cgroup_main_cleanup(void *ptr) {
 
     if (!discovery_thread.exited) {
         info("stopping discovery thread worker");
-        uv_mutex_unlock(&discovery_thread.mutex);
+        uv_mutex_lock(&discovery_thread.mutex);
         discovery_thread.start_discovery = 1;
         uv_cond_signal(&discovery_thread.cond_var);
+        uv_mutex_unlock(&discovery_thread.mutex);
     }
 
     while (!discovery_thread.exited && max > 0) {