-
Incident report
-
Resolution: Fixed
-
Trivial
-
2.4.6
-
Windows Server 2008
See sub-issue (123) in ZBXNEXT-1263.
This is a regression since ZBX-8796, ZBXNEXT-101. process_type, process_num, server_num are NOT thread local variables.
src/zabbix_agent/zabbix_agentd.c
ZBX_THREAD_LOCAL unsigned char process_type = 255; /* ZBX_PROCESS_TYPE_UNKNOWN */ ZBX_THREAD_LOCAL int process_num; ZBX_THREAD_LOCAL int server_num = 0;
src/zabbix_agent/listener.c, etc.
extern unsigned char process_type, program_type; extern int server_num, process_num;
According to Microsoft this should produce (compile time?) errors. We don't have neither errors, nor warnings in our build environment regarding this problem.
You must use the thread attribute for the declaration and the definition of thread local data, regardless of whether the declaration and definition occur in the same file or separate files. For example, the following code generates an error: #define Thread __declspec( thread ) extern int tls_i; /* This generates an error, because the */ int Thread tls_i; /* declaration and the definition differ. */
This causes listener threads reusing the same number due to race condition during thread initialization when agent is started.