]> arthur.barton.de Git - netdata.git/blobdiff - src/plugins_d.c
added pthread_exit in hope it will solve the crash at exit
[netdata.git] / src / plugins_d.c
index 767ca27c062665320a052c9be111b5409ddd9fb3..b4cb57888d7c52296bb6a7af1eb610ff3ffad894 100755 (executable)
@@ -228,8 +228,12 @@ void *pluginsd_worker_thread(void *arg)
                                st = NULL;
                        }
                        else if(likely(hash == CHART_HASH && !strcmp(s, "CHART"))) {
+                               int noname = 0;
                                st = NULL;
 
+                               if((words[1]) != NULL && (words[2]) != NULL && strcmp(words[1], words[2]) == 0)
+                                       noname = 1;
+
                                char *type = words[1];
                                char *id = NULL;
                                if(likely(type)) {
@@ -262,7 +266,7 @@ void *pluginsd_worker_thread(void *arg)
                                int chart_type = RRDSET_TYPE_LINE;
                                if(unlikely(chart)) chart_type = rrdset_type_id(chart);
 
-                               if(unlikely(!name || !*name)) name = NULL;
+                               if(unlikely(noname || !name || !*name || strcasecmp(name, "NULL") == 0 || strcasecmp(name, "(NULL)") == 0)) name = NULL;
                                if(unlikely(!family || !*family)) family = id;
                                if(unlikely(!category || !*category)) category = type;
 
@@ -399,6 +403,7 @@ void *pluginsd_worker_thread(void *arg)
                        cd->pid = 0;
                        cd->enabled = 0;
                        cd->obsolete = 1;
+                       pthread_exit(NULL);
                        return NULL;
                }
 
@@ -413,6 +418,7 @@ void *pluginsd_worker_thread(void *arg)
        }
 
        cd->obsolete = 1;
+       pthread_exit(NULL);
        return NULL;
 }
 
@@ -446,6 +452,7 @@ void *pluginsd_main(void *ptr)
                dir = opendir(dir_name);
                if(unlikely(!dir)) {
                        error("Cannot open directory '%s'.", dir_name);
+                       pthread_exit(NULL);
                        return NULL;
                }
 
@@ -520,6 +527,7 @@ void *pluginsd_main(void *ptr)
                sleep((unsigned int) scan_frequency);
        }
 
+       pthread_exit(NULL);
        return NULL;
 }