@cryptotaxi247 / netdata-1 / commits / 56ee3a770

added pthread_exit in hope it will solve the crash at exit

Costa Tsaousis (ktsaou) committed Feb 6, 2016 at 07:37 UTC 56ee3a77006efdc1fb78ea041986b1f7a6ba42b9
6 files changed +16
src/plugin_checks.c
+1
@@ -91,6 +91,7 @@ void *checks_main(void *ptr)
91 rrdset_done(check3);
92 }
93
94 + pthread_exit(NULL);
95 return NULL;
96 }
97
src/plugin_idlejitter.c
+1
@@ -62,6 +62,7 @@ void *cpuidlejitter_main(void *ptr)
62 rrdset_done(st);
63 }
64
65 + pthread_exit(NULL);
66 return NULL;
67 }
68
src/plugin_nfacct.c
+6
@@ -98,12 +98,14 @@ void *nfacct_main(void *ptr) {
98 nl = mnl_socket_open(NETLINK_NETFILTER);
99 if(!nl) {
100 error("nfacct.plugin: mnl_socket_open() failed");
101 + pthread_exit(NULL);
102 return NULL;
103 }
104
105 if(mnl_socket_bind(nl, 0, MNL_SOCKET_AUTOPID) < 0) {
106 mnl_socket_close(nl);
107 error("nfacct.plugin: mnl_socket_bind() failed");
108 + pthread_exit(NULL);
109 return NULL;
110 }
111 portid = mnl_socket_get_portid(nl);
@@ -127,11 +129,13 @@ void *nfacct_main(void *ptr) {
129 if(!nlh) {
130 mnl_socket_close(nl);
131 error("nfacct.plugin: nfacct_nlmsg_build_hdr() failed");
132 + pthread_exit(NULL);
133 return NULL;
134 }
135
136 if(mnl_socket_sendto(nl, nlh, nlh->nlmsg_len) < 0) {
137 error("nfacct.plugin: mnl_socket_send");
138 + pthread_exit(NULL);
139 return NULL;
140 }
141
@@ -144,6 +148,7 @@ void *nfacct_main(void *ptr) {
148
149 if (ret == -1) {
150 error("nfacct.plugin: error communicating with kernel.");
151 + pthread_exit(NULL);
152 return NULL;
153 }
154
@@ -210,6 +215,7 @@ void *nfacct_main(void *ptr) {
215 }
216
217 mnl_socket_close(nl);
218 + pthread_exit(NULL);
219 return NULL;
220 }
221 #endif
src/plugin_proc.c
+1
@@ -223,5 +223,6 @@ void *proc_main(void *ptr)
223 bcopy(&now, &last, sizeof(struct timeval));
224 }
225
226 + pthread_exit(NULL);
227 return NULL;
228 }
src/plugin_tc.c
+3
@@ -521,6 +521,7 @@ void *tc_main(void *ptr)
521 fp = mypopen(buffer, &tc_child_pid);
522 if(!fp) {
523 error("TC: Cannot popen(\"%s\", \"r\").", buffer);
524 + pthread_exit(NULL);
525 return NULL;
526 }
527
@@ -672,12 +673,14 @@ void *tc_main(void *ptr)
673
674 if(netdata_exit) {
675 tc_device_free_all();
676 + pthread_exit(NULL);
677 return NULL;
678 }
679
680 sleep((unsigned int) rrd_update_every);
681 }
682
683 + pthread_exit(NULL);
684 return NULL;
685 }
686
src/plugins_d.c
+4
@@ -403,6 +403,7 @@ void *pluginsd_worker_thread(void *arg)
403 cd->pid = 0;
404 cd->enabled = 0;
405 cd->obsolete = 1;
406 + pthread_exit(NULL);
407 return NULL;
408 }
409
@@ -417,6 +418,7 @@ void *pluginsd_worker_thread(void *arg)
418 }
419
420 cd->obsolete = 1;
421 + pthread_exit(NULL);
422 return NULL;
423 }
424
@@ -450,6 +452,7 @@ void *pluginsd_main(void *ptr)
452 dir = opendir(dir_name);
453 if(unlikely(!dir)) {
454 error("Cannot open directory '%s'.", dir_name);
455 + pthread_exit(NULL);
456 return NULL;
457 }
458
@@ -524,6 +527,7 @@ void *pluginsd_main(void *ptr)
527 sleep((unsigned int) scan_frequency);
528 }
529
530 + pthread_exit(NULL);
531 return NULL;
532 }
533