[ZBX-6637] proc.mem under solaris 10 return 0 for some process or same mem usage for different process Created: 2013 May 29  Updated: 2017 May 30  Resolved: 2013 Jun 20

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent (G)
Affects Version/s: 2.0.7rc1, 2.1.0
Fix Version/s: None

Type: Incident report Priority: Major
Reporter: Alexey Pustovalov Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: memory, solaris
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

SunOS mscastillon 5.10 Generic_147440-15 sun4u sparc SUNW,SPARC-Enterprise


Attachments: File proc_test     File proc_test64     File proc_test64.c     File test.c     File zabbix_agentd     File zabbix_agentd    
Issue Links:
Duplicate

 Comments   
Comment by Alexey Pustovalov [ 2013 May 29 ]

debug info from customer:

bash-3.2$ uname -a 
SunOS mscastillon 5.10 Generic_147440-15 sun4u sparc SUNW,SPARC-Enterprise 


bash-3.2$ ./zabbix_agentd -V 
Zabbix Agent (daemon) v2.0.6 (revision 35158) (22 April 2013) 
Compilation time: Apr 23 2013 14:43:49 

proc.num return number of process, but proc.mem return 0:

bash-3.2$ ./zabbix_agentd -t proc.num[oracle] 
proc.num[oracle][oracle] [u|163] 
bash-3.2$ ./zabbix_agentd -t proc.mem[oracle] 
proc.mem[oracle][oracle] [u|0] 

bash-3.2$ ./zabbix_agentd -t proc.num[emguisrv] 
proc.num[emguisrv][emguisrv] [u|3] 
bash-3.2$ ./zabbix_agentd -t proc.mem[emguisrv] 
proc.mem[emguisrv][emguisrv] [u|0] 

bash-3.2$ prstat |grep oracle 
     9 oracle 10G 726M sleep 59 0 4:21:46 0.0% oracle/16 
 10408 oracle 10G 6739M sleep 59 0 0:14:31 0.0% oracle/1 
 10402 oracle 10G 6740M sleep 59 0 0:04:54 0.0% oracle/1 
  6787 oracle 10G 6738M sleep 59 0 0:00:00 0.0% oracle/1 
 10535 oracle 10G 6739M sleep 59 0 0:03:47 0.0% oracle/1 

bash-3.2$ prstat |grep emguisrv 
  6600 pctempro 750M 687M sleep 59 0 1:22:24 0.1% emguisrv/111 
  6209 pctempro 762M 698M sleep 59 0 0:38:30 0.1% emguisrv/108 
  6870 pctempro 532M 464M sleep 59 0 0:26:47 0.0% emguisrv/93 

proc.mem with cmdline return same memory usage for different process:

bash-3.2$ ps -edf|grep emguisrv 
pctempro 6209 6155 0 13:45:49 ? 38:40 emguisrv -name msctpx01 
pctempro 6870 6830 0 13:45:52 ? 26:49 emguisrv -name mspctuems01 
pctempro 6600 6555 0 13:45:50 ? 82:35 emguisrv 

bash-3.2$ ./zabbix_agentd -t proc.mem[emguisrv] 
proc.mem[emguisrv][emguisrv] [u|0] 


bash-3.2$ ./zabbix_agentd -t proc.mem[,,,"emguisrv -name msctpx01"] 
proc.mem[,,,emguisrv -name msctpx01][,,,emguisrv -name msctpx01] [u|3923968] 

bash-3.2$ ./zabbix_agentd -t proc.mem[,,,"emguisrv -name mspctuems01"] 
proc.mem[,,,emguisrv -name mspctuems01][,,,emguisrv -name mspctuems01] [u|3923968] 

bash-3.2$ ./zabbix_agentd -t proc.mem[,,,"emguisrv"] 
proc.mem[,,,emguisrv][,,,emguisrv] [u|3923968] 
Comment by Alexey Pustovalov [ 2013 May 29 ]

We use size of process image regarding with source code and http://nadeausoftware.com/articles/2012/07/c_c_tip_how_get_process_resident_set_size_physical_memory_use#procselfpsinfoforpeakresidentsetsize , seems we should use resident set size

prstat show correct info. Source code of prstat can be found on https://www.riebart.ca/files/public/Solaris%20Source%20Code/solaris11/usr/src/cmd/prstat/prstat.c

Comment by Igors Homjakovs (Inactive) [ 2013 Jun 17 ]

Simple program to print process info.

Comment by Igors Homjakovs (Inactive) [ 2013 Jun 18 ]

New files for 64-bit platform. Compile with -m64 flag.

Comment by Igors Homjakovs (Inactive) [ 2013 Jun 20 ]

Zabbix agent (2.0.7rc1) compiled on 64-bit Solaris 5.10 (sparc) with -m64 flag.

Comment by dimir [ 2013 Jun 20 ]

(1) New exception for Solaris because of this. By default now in case of 64-bit Solaris the agent, sender and get will be compiled as 64-bit applications (previously they were compiled as 32-bit). The reason is that otherwise functionality like proc.mem will not be able to handle values greater than integer (e. g. using proc.mem to read memory size taken by a process that consumes over 4 GB of RAM).

Also the provided Solaris agent binaries (from zabbix.com/download.php) will change from 32-bit applications to 64-bit.

This should be mentioned in whatsnew (2.0).

Having this change for all platforms should be probably discussed.

igorsh https://www.zabbix.com/documentation/2.0/manual/introduction/whatsnew207

RESOLVED

dimir CLOSED with changes of the description

Comment by Igors Homjakovs (Inactive) [ 2013 Jun 20 ]

Zabbix agent compiled for 32-bit Solaris.

Comment by Andris Mednis [ 2013 Jul 11 ]

The fix was successfully tested on Solaris systems with 64-bit kernels, capable of running 32-bit and 64-bit executables (old systems with 32-bit kernel were not available for testing).

(2) [D] If Zabbix agent is compiled with old compiler (e.g. GCC 2.95.3 on Solaris 2.9) then "-m64" flag is actually not working and a 32-bit executable is produced. Let's put a warning into Zabbix documentation: if you are compiling Zabbix agent from source code, make sure 64-bit executables were produced, like

$ file sbin/zabbix_agent*
sbin/zabbix_agent:      ELF 64-bit MSB executable SPARCV9 Version 1, dynamically linked, not stripped
sbin/zabbix_agentd:     ELF 64-bit MSB executable SPARCV9 Version 1, dynamically linked, not stripped

Otherwise, with 32-bit executables, "proc.mem" measurements will silently produce wrong results.
(Tests with GCC 3.4.3 on Solaris 10 produced 64-bit executables.)

Maybe it is better to build this check into "configure.in" and exit with failure on a 64-bit system, if "-m64" flag does not work due to old compiler ?

igorsh https://www.zabbix.com/documentation/2.0/manual/introduction/whatsnew207

RESOLVED
andris CLOSED

Generated at Sat Apr 20 09:25:00 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.