[SERVER-8673] ns field in curop is blank for pending write ops Created: 22/Feb/13  Updated: 06/Dec/22  Resolved: 02/Dec/16

Status: Closed
Project: Core Server
Component/s: Diagnostics
Affects Version/s: 2.4.0-rc0
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Eric Milkie Assignee: Backlog - Query Team (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Query
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

You can see this in the output if you run jstests/currentOp.js

Participants:

 Description   

For read contexts we set the curop ns field at Context construction time.
For write, we set the field when we "enter" the lock, which means while the lock is still queued you get a CurOp document that looks something like this:

	{
		"opid" : 119,
		"active" : false,
		"op" : "update",
		"ns" : "",
		"query" : {
			"$where" : function () { sleep(150); }
		},
		"client" : "127.0.0.1:49343",
		"desc" : "conn3",
		"threadId" : "0x7fb1720af700",
		"connectionId" : 3,
		"locks" : {
			"^test" : "W"
		},
		"waitingForLock" : true,
		"numYields" : 0,
		"lockStats" : {
			"timeLockedMicros" : {
				
			},
			"timeAcquiringMicros" : {
				
			}
		}
	}



 Comments   
Comment by Charlie Swanson [ 02/Dec/16 ]

Looks like this has been fixed on master:

> db.currentOp()
{
	"inprog" : [
		{
			"desc" : "conn2",
			"threadId" : "0x700004d1b000",
			"connectionId" : 2,
			"client" : "127.0.0.1:63697",
			"appName" : "MongoDB Shell",
			"active" : true,
			"opid" : 1226,
			"secs_running" : 11,
			"microsecs_running" : NumberLong(11719727),
			"op" : "update",
			"ns" : "test.foo",
			"query" : {
				
			},
			"numYields" : 0,
			"locks" : {
				"Global" : "w"
			},
			"waitingForLock" : true,
			"lockStats" : {
				"Global" : {
					"acquireCount" : {
						"r" : NumberLong(1),
						"w" : NumberLong(1)
					},
					"acquireWaitCount" : {
						"w" : NumberLong(1)
					},
					"timeAcquiringMicros" : {
						"w" : NumberLong(11561478)
					}
				}
			}
		},
                // ...

Comment by Charlie Swanson [ 18/Nov/16 ]

Moving this to the query team for triage, it seems like a query team issue? We can bounce to another team if not.

Comment by Eric Milkie [ 22/Feb/13 ]

Some other fields are also not populated, including (critically) the amount of time we've been waiting for a write lock:

	{
 
	
 
		"opid" : 30080,
 
	
 
		"active" : false,
 
	
 
		"op" : "insert",
 
	
 
		"ns" : "",
 
	
 
		"insert" : {
 
	
 
			
 
	
 
		},
 
	
 
		"client" : "127.0.0.1:54353",
 
	
 
		"desc" : "conn30",
 
	
 
		"connectionId" : 30,
 
	
 
		"locks" : {
 
	
 
			"^test" : "W"
 
	
 
		},
 
	
 
		"waitingForLock" : true,
 
	
 
		"numYields" : 0,
 
	
 
		"lockStats" : {
 
	
 
			"timeLockedMicros" : {
 
	
 
				
 
	
 
			},
 
	
 
			"timeAcquiringMicros" : {
 
	
 
				
 
	
 
			}
 
	
 
		}
 
	
 
	},
 
	
 
	{
 
	
 
		"opid" : 30082,
 
	
 
		"active" : false,
 
	
 
		"op" : "query",
 
	
 
		"ns" : "",
 
	
 
		"query" : {
 
	
 
			"drop" : "jstests_orm"
 
	
 
		},
 
	
 
		"client" : "127.0.0.1:54362",
 
	
 
		"desc" : "conn31",
 
	
 
		"connectionId" : 31,
 
	
 
		"locks" : {
 
	
 
			"^test" : "W"
 
	
 
		},
 
	
 
		"waitingForLock" : true,
 
	
 
		"numYields" : 0,
 
	
 
		"lockStats" : {
 
	
 
			"timeLockedMicros" : {
 
	
 
				
 
	
 
			},
 
	
 
			"timeAcquiringMicros" : {
 
	
 
				
 
	
 
			}
 
	
 
		}
 
	
 
	},
 
	
 
	{
 
	
 
		"opid" : 30081,
 
	
 
		"active" : false,
 
	
 
		"op" : "remove",
 
	
 
		"ns" : "",
 
	
 
		"query" : {
 
	
 
			"_id" : ObjectId("51272273ed34a6664c6b5b00")
 
	
 
		},
 
	
 
		"client" : "127.0.0.1:54386",
 
	
 
		"desc" : "conn32",
 
	
 
		"connectionId" : 32,
 
	
 
		"locks" : {
 
	
 
			"^test" : "W"
 
	
 
		},
 
	
 
		"waitingForLock" : true,
 
	
 
		"numYields" : 0,
 
	
 
		"lockStats" : {
 
	
 
			"timeLockedMicros" : {
 
	
 
				
 
	
 
			},
 
	
 
			"timeAcquiringMicros" : {
 
	
 
				
 
	
 
			}
 
	
 
		}
 
	
 
	},

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