Bug 1377452

Summary: Integer overflow in performance counters
Product: Red Hat Enterprise Linux 7 Reporter: Viktor Ashirov <vashirov>
Component: 389-ds-baseAssignee: Noriko Hosoi <nhosoi>
Status: CLOSED ERRATA QA Contact: Viktor Ashirov <vashirov>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.3CC: mreynolds, nkinder, rmeggins
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 389-ds-base-1.3.6.1-10.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 21:10:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Viktor Ashirov 2016-09-19 17:58:34 UTC
Description of problem:

From https://bugzilla.redhat.com/show_bug.cgi?id=1349577

There is another overflow in performance counters:
./ldap/servers/slapd/back-ldbm/perfctrs.h:
 33     PRUint32    page_access_rate;

./ldap/servers/slapd/back-ldbm/perfctrs.c:
167             perf->cache_size_bytes = mpstat->st_gbytes * ONEG + mpstat->st_bytes;
168             perf->page_access_rate = mpstat->st_cache_hit + mpstat->st_cache_miss;       <===
169             perf->cache_hit = mpstat->st_cache_hit;
170             perf->cache_try = mpstat->st_cache_hit + mpstat->st_cache_miss;              <===

Also objects-locked has the value of page_access_rate:
260     { SLAPI_LDBM_PERFCTR_AT_PREFIX "objects-locked",
261             offsetof( performance_counters, page_access_rate ) },
262     { SLAPI_LDBM_PERFCTR_AT_PREFIX "page-create-rate",
263             offsetof( performance_counters, page_create_rate ) },

ldapsearch -x -D "cn=Directory Manager" -w Secret123  -b "cn=monitor,cn=ldbm database,cn=plugins,cn=config"  -LLL dbcachetries  nsslapd-db-objects-locked
dn: cn=monitor,cn=ldbm database,cn=plugins,cn=config
dbcachetries: 509565

dn: cn=database,cn=monitor,cn=ldbm database,cn=plugins,cn=config
nsslapd-db-objects-locked: 509565

Version-Release number of selected component (if applicable):
389-ds-base-1.3.5.10-11.el7.x86_64

Comment 1 Noriko Hosoi 2016-09-19 18:32:16 UTC
Upstream ticket:
https://fedorahosted.org/389/ticket/48989

Comment 2 mreynolds 2017-03-20 15:12:45 UTC
*** Bug 1396420 has been marked as a duplicate of this bug. ***

Comment 3 mreynolds 2017-03-22 00:19:17 UTC
Fixed upstream

Comment 5 Viktor Ashirov 2017-05-02 15:05:10 UTC
Build tested:
389-ds-base-1.3.6.1-9.el7.x86_64

nsslapd-db-objects-locked and dbcachetries still have the same value, though they shouldn't. page_access_rate shouldn't be calculated based on cache tries.

Marking as ASSIGNED.

Comment 6 mreynolds 2017-05-02 16:02:45 UTC
(In reply to Viktor Ashirov from comment #5)
> Build tested:
> 389-ds-base-1.3.6.1-9.el7.x86_64
> 
> nsslapd-db-objects-locked and dbcachetries still have the same value, though
> they shouldn't. page_access_rate shouldn't be calculated based on cache
> tries.
> 
> Marking as ASSIGNED.

So nsslapd-db-objects-locked is actually a duplicate of nsslapd-db-current-lock-objects.  And page_access_rate is a made up stat that uses the same formula as cache tries.  So again it's kind of a duplicate stat which I'm just going to remove.  Fix is in progress upstream.

Comment 7 mreynolds 2017-05-03 14:05:31 UTC
Fixed upstream

Comment 9 Viktor Ashirov 2017-05-14 18:03:53 UTC
========================================================== test session starts ==========================================================
platform linux2 -- Python 2.7.5, pytest-3.0.7, py-1.4.33, pluggy-0.4.0 -- /usr/bin/python
cachedir: .cache
metadata: {'Python': '2.7.5', 'Platform': 'Linux-3.10.0-663.el7.x86_64-x86_64-with-redhat-7.4-Maipo', 'Packages': {'py': '1.4.33', 'pytest': '3.0.7', 'pluggy': '0.4.0'}, 'Plugins': {'beakerlib': '0.7.1', 'html': '1.14.2', 'cov': '2.5.1', 'metadata': '1.4.0'}}
DS build: 1.3.6.1
389-ds-base: 1.3.6.1-13.el7
nss: 3.28.4-6.el7
nspr: 4.13.1-1.0.el7_3
openldap: 2.4.44-4.el7
svrcore: 4.1.3-2.el7

rootdir: /export/tests, inifile:
plugins: metadata-1.4.0, html-1.14.2, cov-2.5.1, beakerlib-0.7.1
collected 1 items 

tickets/issue48989_test.py::test_bytessent_overflow PASSED

------------------------------------- generated xml file: /mnt/tests/rhds/tests/upstream/report.xml -------------------------------------
------------------------------------ generated html file: /mnt/tests/rhds/tests/upstream/report.html ------------------------------------
====================================================== 1 passed in 870.09 seconds =======================================================

nsslapd-db-objects-locked is no longer present, marking as VERIFIED.

Comment 10 errata-xmlrpc 2017-08-01 21:10:21 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:2086