@cryptotaxi247 / netdata-1 / commits / 195856feb

[Fix] remove pthread_setname_np segfault on musl (#7664)

Reported by #7626 on Docker, this segfault occurs with cpuidle plugin. The name setting was set after a pthread_join, thus occuring after the thread was terminated. While glibc handles this correctly, musl segfault

Adrien Mahieux committed Jan 2, 2020 at 21:58 UTC 195856feb38d27b4ac15fb5006615690a900a40b
1 file changed +1 -2
collectors/proc.plugin/proc_stat.c
+1 -2
@@ -1003,12 +1003,11 @@ int do_proc_stat(int update_every, usec_t dt) {
1003 else
1004 error("Cannot read current process affinity");
1005
1006 + // These threads are very ephemeral and don't need to have a specific name
1007 if(unlikely(pthread_create(&thread, NULL, wake_cpu_thread, (void *)&core)))
1008 error("Cannot create wake_cpu_thread");
1009 else if(unlikely(pthread_join(thread, NULL)))
1010 error("Cannot join wake_cpu_thread");
1010 - if(thread)
1011 - pthread_setname_np(thread, "PLUGIN[cpuidle]");
1011 cpu_states_updated = 1;
1012 }
1013 }