[Date Prev][Date Next] [Chronological] [Thread] [Top]

stats (and back-monitor) counters wrap when overflowing (ITS#3323)

Full_Name: Pierangelo Masarati
Version: 2.2.15, HEAD
OS: irrelevant
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (

I noted that counters in back-monitor, which reflect values incremented by
frontend when performing operations, do wrap when the max value is reached, and
get negative values.  E.g., from my torture test (~20 hours of 50 concurrent
reads and writes over a 10000 entries DB, ~2500000 ops):

    # ldapsearch -LLL -b 'cn=monitor' '(monitorCounter=*)'
    dn: cn=Bytes,cn=Statistics,cn=Monitor
    monitorCounter: -2083887046

    dn: cn=PDU,cn=Statistics,cn=Monitor
    monitorCounter: 170793975


One mandatory fix is to use unsigned counters, to avoid at least the negative
A short term solution (which only defers the problem) would be to use long long
where available, or to separate values into major and minor, and compose the
value in string form.
An ultimate solution would be to use an arbitrary precision math library.