[SERVER-14341] negative opcounter values in serverStatus Created: 24/Jun/14  Updated: 11/Jul/16  Resolved: 26/Jun/14

Status: Closed
Project: Core Server
Component/s: Diagnostics, Shell
Affects Version/s: 2.6.1
Fix Version/s: 2.6.4, 2.7.3

Type: Bug Priority: Major - P3
Reporter: James Wahlin Assignee: J Rassi
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
is related to SERVER-14364 OpCounters values should be stored/ex... Closed
Operating System: ALL
Backport Completed:
Steps To Reproduce:

Perform operations against mongod that push one of the opcounters to an unsigned integer value that would be interpreted as negative if cast to a signed integer.

Run db.serverStatus() via mongo shell.

Participants:

 Description   
Issue Status as of Jul 22, 2014

ISSUE SUMMARY
The opcounter values that the serverStatus command returns are stored in mongod as an unsigned 32-bit integer, however serverStatus returns these values as a signed 32-bit integer. This can cause negative numbers to be displayed if the opcounter values are large enough.

USER IMPACT
This is a cosmetic issue, but can lead to confusion and obfuscate the real opcounter values. Custom scripts that parse these values may receive unexpected input.

WORKAROUNDS
A restart of the mongod server resets the opcounter values back to 0.

AFFECTED VERSIONS
All production releases from 2.6.0 to 2.6.3 are affected by the issue.

FIX VERSION
The fix is included in the 2.6.4 production release.

RESOLUTION DETAILS
The fix correctly resets the operation counters when any counter grows close to the maximum value of a signed 32-bit integer.

Original description

The opcounter values that the serverStatus command returns are stored in mongod as unsigned integer. serverStatus returns these values as a signed integer which can mean negative values if not converted back to unsigned.

We should look to return the full positive value.



 Comments   
Comment by Githook User [ 21/Jul/14 ]

Author:

{u'username': u'jrassi', u'name': u'Jason Rassi', u'email': u'rassi@10gen.com'}

Message: SERVER-14341 OpCounters missing calls to _checkWrap() added back

(cherry picked from commit 6937b273a7a9db13279161ba3e74259eb89b0d15)
Branch: v2.6
https://github.com/mongodb/mongo/commit/49eb8f24b3e2ba1a7253b0d7a0022c45f78ca3b6

Comment by Githook User [ 26/Jun/14 ]

Author:

{u'username': u'jrassi', u'name': u'Jason Rassi', u'email': u'rassi@10gen.com'}

Message: SERVER-14341 OpCounters missing calls to _checkWrap() added back
Branch: master
https://github.com/mongodb/mongo/commit/6937b273a7a9db13279161ba3e74259eb89b0d15

Generated at Thu Feb 08 03:34:33 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.