@cryptotaxi247 / netdata-1 / commits / 5bc76f3b5

Fixed ACLK shutdown sequence (#9367)

* fix aclk shutdown sequence

Timotej S committed Jun 18, 2020 at 12:46 UTC 5bc76f3b5bbba126c5bc651f4ada897c6ae05a94
2 files changed +8 -3
aclk/aclk_stats.c
+1
@@ -160,6 +160,7 @@ void *aclk_stats_main_thread(void *ptr)
160 // Wait for the next iteration point.
161
162 heartbeat_next(&hb, step_ut);
163 + if (netdata_exit) break;
164
165 ACLK_STATS_LOCK;
166 // to not hold lock longer than necessary, especially not to hold it
aclk/agent_cloud_link.c
+7 -3
@@ -1063,9 +1063,6 @@ static void aclk_main_cleanup(void *ptr)
1063 QUERY_THREAD_WAKEUP;
1064 aclk_graceful_disconnect();
1065 }
1066 -
1067 -
1068 - static_thread->enabled = NETDATA_MAIN_THREAD_EXITED;
1066 }
1067
1068 struct dictionary_singleton {
@@ -1538,6 +1535,13 @@ exited:
1535 freez(stats_thread);
1536 }
1537
1538 + /*
1539 + * this must be last -> if all static threads signal
1540 + * THREAD_EXITED rrdengine will dealloc the RRDSETs
1541 + * and RRDDIMs that are used by still runing stat thread.
1542 + * see netdata_cleanup_and_exit() for reference
1543 + */
1544 + static_thread->enabled = NETDATA_MAIN_THREAD_EXITED;
1545 return NULL;
1546 }
1547