[ZBX-5804] Overflow in calculated items Created: 2012 Nov 05  Updated: 2017 May 30  Resolved: 2014 Mar 03

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Server (S)
Affects Version/s: 2.0.3
Fix Version/s: 2.0.12rc1, 2.2.3rc1, 2.3.0

Type: Incident report Priority: Major
Reporter: Bart Verwilst Assignee: Unassigned
Resolution: Fixed Votes: 2
Labels: calculateditems, overflow
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

I have a calculated item ( Numeric Unsigned, unit s ) which does the following:

last(system.localtime) - last(puppet.run.timestamp)

It should return me the number of seconds since the last puppet run. Which it does fine until a new puppetrun runs.
These are the values from the item:

2012.Nov.05 10:01:52 157
2012.Nov.05 09:59:52 157
2012.Nov.05 09:57:52 157
2012.Nov.05 09:55:52 157
2012.Nov.05 09:53:52 18446744073709551173
2012.Nov.05 09:51:52 3158
2012.Nov.05 09:49:52 3158
2012.Nov.05 09:47:52 3158
2012.Nov.05 09:45:52 3158
2012.Nov.05 09:43:52 2557
2012.Nov.05 09:41:52 2557
2012.Nov.05 09:39:52 2557
2012.Nov.05 09:37:52 2557
2012.Nov.05 09:35:52 2557
2012.Nov.05 09:33:52 1957
2012.Nov.05 09:31:52 1957
2012.Nov.05 09:29:52 1957
2012.Nov.05 09:27:52 1957
2012.Nov.05 09:25:52 1957
2012.Nov.05 09:23:52 1357
2012.Nov.05 09:21:52 1357
2012.Nov.05 09:19:52 1357
2012.Nov.05 09:17:52 1357
2012.Nov.05 09:15:52 1357
2012.Nov.05 09:13:52 757
2012.Nov.05 09:11:52 757

My guess is, because system.localtime is older ( and thus smaller, runs every 15 mins ) than puppet.run.timestamp ( updated every 120 secs ), the calculation is negative, and instead of returning 0, it overflows to a giant number?



 Comments   
Comment by richlv [ 2012 Nov 06 ]

zabbix does not validate internal calculations against data type. while that could be added, it would break some assumptions (like using unsigned ints for network traffic)... not sure how to proceed

Comment by Alexander Vladishev [ 2014 Feb 13 ]

In this case item should change state to not supported.

Comment by Juris Miščenko (Inactive) [ 2014 Feb 21 ]

Added error message for overflown results calculated via incorrect values.

Comment by Aleksandrs Saveljevs [ 2014 Feb 25 ]

Development branch is svn://svn.zabbix.com/branches/dev/ZBX-5804 .

Comment by Aleksandrs Saveljevs [ 2014 Feb 25 ]

(1) In case of calculated items, the fix does not make the item go unsupported and no error message is shown in the frontend on overflow.

In general, though, it would be nice to design a more general approach for handling overflow and unsuitable data. For instance, SSH checks that return "-1", which is unsuitable for unsigned integer type, do not go unsupported either and no error message is shown.

So this task seems to cover a wider area that just calculated items and a substantial design for value conversion errors seems to be needed.

jurism
Return value setting has been added. The error message is being set but the code hasn't been synchronized with the frontend yet. RESOLVED.

asaveljevs There is nothing to sync with the frontend. The item did not become unsupported and no error message was shown because "ret = NOTSUPPORTED;" was missing.

asaveljevs The fix looks good now. We might wish to replace "Received..." with "Calculated...", but we might leave it for now for consistency. Please see r43122 before merging.

asaveljevs Let's merge it into 2.0, 2.2 and trunk. After that, as sasha proposed, let's devise a more general solution for trunk only under this issue. No need to create another.

Comment by Alexander Vladishev [ 2014 Mar 03 ]

Related issues: ZBX-1274, ZBX-2966

Comment by Juris Miščenko (Inactive) [ 2014 Mar 06 ]

Fixed in 2.0.12rc1 r43267, 2.2.3rc1 r43268, 2.3.0 (trunk) r43269

Generated at Fri Mar 29 13:27:10 EET 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.