From 56ee3a77006efdc1fb78ea041986b1f7a6ba42b9 Mon Sep 17 00:00:00 2001 From: "Costa Tsaousis (ktsaou)" Date: Sat, 6 Feb 2016 07:37:21 +0200 Subject: [PATCH] added pthread_exit in hope it will solve the crash at exit --- src/plugin_checks.c | 1 + src/plugin_idlejitter.c | 1 + src/plugin_nfacct.c | 6 ++++++ src/plugin_proc.c | 1 + src/plugin_tc.c | 3 +++ src/plugins_d.c | 4 ++++ 6 files changed, 16 insertions(+) diff --git a/src/plugin_checks.c b/src/plugin_checks.c index d597e346..62cc31da 100755 --- a/src/plugin_checks.c +++ b/src/plugin_checks.c @@ -91,6 +91,7 @@ void *checks_main(void *ptr) rrdset_done(check3); } + pthread_exit(NULL); return NULL; } diff --git a/src/plugin_idlejitter.c b/src/plugin_idlejitter.c index 8f55a002..a7197330 100755 --- a/src/plugin_idlejitter.c +++ b/src/plugin_idlejitter.c @@ -62,6 +62,7 @@ void *cpuidlejitter_main(void *ptr) rrdset_done(st); } + pthread_exit(NULL); return NULL; } diff --git a/src/plugin_nfacct.c b/src/plugin_nfacct.c index 8c613c4c..0c5b3945 100644 --- a/src/plugin_nfacct.c +++ b/src/plugin_nfacct.c @@ -98,12 +98,14 @@ void *nfacct_main(void *ptr) { nl = mnl_socket_open(NETLINK_NETFILTER); if(!nl) { error("nfacct.plugin: mnl_socket_open() failed"); + pthread_exit(NULL); return NULL; } if(mnl_socket_bind(nl, 0, MNL_SOCKET_AUTOPID) < 0) { mnl_socket_close(nl); error("nfacct.plugin: mnl_socket_bind() failed"); + pthread_exit(NULL); return NULL; } portid = mnl_socket_get_portid(nl); @@ -127,11 +129,13 @@ void *nfacct_main(void *ptr) { if(!nlh) { mnl_socket_close(nl); error("nfacct.plugin: nfacct_nlmsg_build_hdr() failed"); + pthread_exit(NULL); return NULL; } if(mnl_socket_sendto(nl, nlh, nlh->nlmsg_len) < 0) { error("nfacct.plugin: mnl_socket_send"); + pthread_exit(NULL); return NULL; } @@ -144,6 +148,7 @@ void *nfacct_main(void *ptr) { if (ret == -1) { error("nfacct.plugin: error communicating with kernel."); + pthread_exit(NULL); return NULL; } @@ -210,6 +215,7 @@ void *nfacct_main(void *ptr) { } mnl_socket_close(nl); + pthread_exit(NULL); return NULL; } #endif diff --git a/src/plugin_proc.c b/src/plugin_proc.c index 7f79364e..ac96cb50 100755 --- a/src/plugin_proc.c +++ b/src/plugin_proc.c @@ -223,5 +223,6 @@ void *proc_main(void *ptr) bcopy(&now, &last, sizeof(struct timeval)); } + pthread_exit(NULL); return NULL; } diff --git a/src/plugin_tc.c b/src/plugin_tc.c index 15b8077c..5ed91405 100755 --- a/src/plugin_tc.c +++ b/src/plugin_tc.c @@ -521,6 +521,7 @@ void *tc_main(void *ptr) fp = mypopen(buffer, &tc_child_pid); if(!fp) { error("TC: Cannot popen(\"%s\", \"r\").", buffer); + pthread_exit(NULL); return NULL; } @@ -672,12 +673,14 @@ void *tc_main(void *ptr) if(netdata_exit) { tc_device_free_all(); + pthread_exit(NULL); return NULL; } sleep((unsigned int) rrd_update_every); } + pthread_exit(NULL); return NULL; } diff --git a/src/plugins_d.c b/src/plugins_d.c index c07e592e..b4cb5788 100755 --- a/src/plugins_d.c +++ b/src/plugins_d.c @@ -403,6 +403,7 @@ void *pluginsd_worker_thread(void *arg) cd->pid = 0; cd->enabled = 0; cd->obsolete = 1; + pthread_exit(NULL); return NULL; } @@ -417,6 +418,7 @@ void *pluginsd_worker_thread(void *arg) } cd->obsolete = 1; + pthread_exit(NULL); return NULL; } @@ -450,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; } @@ -524,6 +527,7 @@ void *pluginsd_main(void *ptr) sleep((unsigned int) scan_frequency); } + pthread_exit(NULL); return NULL; } -- 2.39.2