[ZBX-9847] Zabbix Agent crashes on system.cpu.discovery on Intel Solaris 10 Created: 2015 Sep 03  Updated: 2017 May 30  Resolved: 2015 Oct 08

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent (G)
Affects Version/s: 2.4.4
Fix Version/s: 2.4.7rc1, 3.0.0alpha3

Type: Incident report Priority: Major
Reporter: Ingus Vilnis Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: agent, lld, solaris, zones
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

zone, Oracle Solaris 10 8/11 s10x_u10wos_17b X8


Attachments: Text File 2.4.4-crash.txt     Text File 2.4.4-works-with-discovery.disabled.txt    
Issue Links:
Duplicate

 Description   

Zabbix Agent crashes when executing system.cpu.discovery item key for LLD rule on Intel Solaris 10.

Agent working as expected when CPU discovery disabled.



 Comments   
Comment by dimir [ 2015 Sep 07 ]

Might be related to ZBX-9739.

Comment by dimir [ 2015 Sep 16 ]

The crash happens on systems where CPUs are not numbered sequentially starting with 0. Before this fix agent would crash on system.cpu.discovery on both of the following systems:

$ mpstat
 CPU minf mjf xcal  intr ithr  csw icsw migr smtx  srw syscl  usr sys  st idl
   2    5   0    0     5    3   13    0    1    0    0    41    0   0   0 100
$ mpstat
 CPU minf mjf xcal  intr ithr  csw icsw migr smtx  srw syscl  usr sys  st idl
   0    5   0    0     5    3  13    0    1    0    0    41    0   0   0 100
   1   12   0    0     6    1   7    0    1    0    0    25    0   0   0 99
   2    3   0    0     5    1  12    0    1    0    0    12    0   0   0 100
   5    7   0    0     5    2   1    0    1    0    0    51    0   0   0 98
Comment by dimir [ 2015 Sep 16 ]

Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-9847.

Comment by Andris Zeila [ 2015 Sep 25 ]

(1) CPU statistics gathering does not work on AIX 6.1

RESOLVED in r55759, please review

<dimir> Thanks! CLOSED

Comment by dimir [ 2015 Sep 28 ]

The fix is in file src/zabbix_agent/cpustat.c function get_cpus(). get_cpustat_by_num() can return NULL.

Before this fix:
1. In case CPUs in the system are not named sequentially starting from 0 system.cpu.discovery would crash (so far seen in Solaris zone).
2. The returned value of {#CPU.NUMBER} when executing system.cpu.discovery on Solaris was incorrect.

After this fix:
1. system.cpu.discovery would never crash the agent.
2. The returned value of {#CPU.NUMBER} when executing system.cpu.discovery on Solaris is correct for item prototype.

Fixed in pre-2.4.7 (r55796), pre-3.0.0 (r55797).

Comment by dimir [ 2015 Sep 28 ]

Documentation:

What's new in 2.4.7

Comment by Aleksandrs Saveljevs [ 2015 Sep 28 ]

(2) There is now the following compilation warning:

cpu.c:50:81: warning: implicit declaration of function 'zbx_strerror' is invalid in C99
      [-Wimplicit-function-declaration]
                SET_MSG_RESULT(result, zbx_dsprintf(NULL, "Cannot obtain number of CPUs: %s", zbx_strerro...
                                                                                              ^
../../../../include/common.h:917:89: note: expanded from macro 'zbx_dsprintf'
#       define zbx_dsprintf(dest, fmt, ...) __zbx_zbx_dsprintf(dest, ZBX_CONST_STRING(fmt), ##__VA_ARGS__)
                                                                                              ^
../../../../include/module.h:131:24: note: expanded from macro 'SET_MSG_RESULT'
        (res)->msg = (char *)(val)              \
                              ^
1 warning generated.

<dimir> RESOLVED in r55796 (2.4), r55797 (trunk).

asaveljevs CLOSED

Generated at Fri Apr 26 12:12:40 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.