-
Problem report
-
Resolution: Won't fix
-
Major
-
None
-
3.4.2, 3.4.3
-
Centos 7
-
Sprint 19
Since Zabbix 3.4.2 something seems to have changed in the value loadable modules are handled by Zabbix.
I had developed a very simple module that mimics zabbix_get behavior to communicate with VMBix (used to query my VMWare infrastructure). Since v3.4.2, this loadable module makes a proxy or agent crash (not tested with the server).
Here is a excerpt of the code (sorry I'm not a C developer) :
A zbx_module_vmbix function is declared :
static int zbx_module_vmbix(AGENT_REQUEST *request, AGENT_RESULT *result);
int zbx_module_vmbix(AGENT_REQUEST *request, AGENT_RESULT *result) char *value = NULL; // ... ret = zbx_module_get_value(source_ip, CONFIG_VMBIX_HOST, CONFIG_VMBIX_PORT, key, &value);
This function is :
/****************************************************************************** * * * Function: zbx_module_get_value * * * * Purpose: connect with Zabbix agent protocol, receive and print value * * * * Parameters: host - server name or IP address * * port - port number * * key - item's key * * * ******************************************************************************/ static int zbx_module_get_value(const char *source_ip, const char *host, unsigned short port, const char *key, char **value) { zbx_socket_t s; int ret; ssize_t bytes_received = -1; char *request; assert(value); *value = NULL; if (SUCCEED == (ret = zbx_tcp_connect(&s, source_ip, host, port, GET_SENDER_TIMEOUT, ZBX_TCP_SEC_UNENCRYPTED, NULL, NULL))) { request = zbx_dsprintf(NULL, "%s\n", key); if (SUCCEED == (ret = zbx_tcp_send(&s, request))) { if (0 < (bytes_received = zbx_tcp_recv_ext(&s, ZBX_TCP_READ_UNTIL_CLOSE, 0))) { if (0 != strcmp(s.buffer, ZBX_NOTSUPPORTED) || sizeof(ZBX_NOTSUPPORTED) >= s.read_bytes) { zbx_rtrim(s.buffer, "\r\n"); *value = strdup(s.buffer); } } } zbx_free(request); zbx_tcp_close(&s); } return ret; }
Zabbix crashes when leaving this last function. It used to work before 3.4.2 (from 3.0.0 to 3.4.1).
Can you point me to a direction ? I've attached the backtrace.