Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-6550

db.currentOp() incorrectly reports insert secs_running as 1271310

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: 2.2.0-rc0
    • Fix Version/s: None
    • Component/s: Diagnostics
    • Labels:
      None
    • Environment:
      linux and osx
    • Operating System:
      ALL

      Description

      First noticed this in the http console, but repro'd in the shell.

      Open two different connections to mongod with and insert a million simple docs:

      > for (i = 0; i < 1000000; i++) { db.foo.insert({x:i}); }

      From a third shell, filter the currentOp output:

      > while ( 1 ) { db.currentOp().inprog.filter(function(x) { if ( x.secs_running == 1271310 ) { printjson(x); } } ) } 

      You should see lots of ops reported with the bad secs_running value:

      {
      	"opid" : 783608,
      	"active" : true,
      	"secs_running" : 1271310,
      	"op" : "insert",
      	"ns" : "",
      	"query" : {
      		
      	},
      	"client" : "127.0.0.1:54088",
      	"desc" : "conn14",
      	"threadId" : "0x112460000",
      	"connectionId" : 14,
      	"locks" : {
      		"^" : "w",
      		"^foo" : "W"
      	},
      	"waitingForLock" : false,
      	"numYields" : 0,
      	"lockStats" : {
      		"timeLockedMicros" : {
      			
      		},
      		"timeAcquiringMicros" : {
      			"r" : NumberLong(0),
      			"w" : NumberLong(3)
      		}
      	}
      }

      secs_running is calculated by subtracting curTimeMicros64() value from the _start recorded for the currentOp (another call to curTimeMicros64()) in curop.h – perhaps the current time value is less than the _start value causing some overflow issue?

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: