[SERVER-34519] mongo_lock.py generating malformed graphviz output Created: 17/Apr/18  Updated: 29/Oct/23  Resolved: 18/Apr/18

Status: Closed
Project: Core Server
Component/s: Testing Infrastructure
Affects Version/s: None
Fix Version/s: 3.7.6

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

Attachments: PNG File Screen Shot 2018-04-17 at 11.20.35 AM.png    
Issue Links:
Problem/Incident
is caused by SERVER-33987 add thread name to hang analyzer output Closed
Related
related to SERVER-37228 Escape double quotes in hang analyzer... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Storage NYC 2018-04-23
Participants:

 Description   

I am running the following in the mongo shell against current master. This opens a multi-statement transaction and then runs a collection drop outside of the transaction which blocks on the stashed transaction resources.

db.test.drop();
assert.writeOK(db.test.insert({}, {writeConcern: {w: "majority"}}));
const session = db.getMongo().startSession({})
session.startTransaction({readConcern: {level: "snapshot"}})
const sessionDB = session.getDatabase("test");
assert.commandWorked(sessionDB.runCommand({find: "test"}));
db.test.drop();

See the attached screenshot for the result. The graphviz output which generates this is:

digraph "mongod+lock-status" {
    "Thread 0x7fd29e216700" -> "Lock 0x559449183b00";
    "Lock 0x559449183b00" -> "Thread 0x7fd29e216700";
    "Thread 0x7fd29233f700" -> "Lock 0x559449183b00";
    "Thread 0x7fd29e216700" [label=""conn2" (Thread 0x7fd29e216700 (LWP 16109))" ]
    "Lock 0x559449183b00" [label="Lock 0x559449183b00 (MongoDB lock)" ]
    "Thread 0x7fd29233f700" [label=""clientcursormon" (Thread 0x7fd29233f700 (LWP 16068))" ]
}



 Comments   
Comment by Githook User [ 18/Apr/18 ]

Author:

{'name': 'James Wahlin', 'username': 'jameswahlin', 'email': 'james@mongodb.com'}

Message: SERVER-34519 mongo_lock.py generating malformed graphviz output
Branch: master
https://github.com/mongodb/mongo/commit/27932e642e7ee583418c982172b0f0465ac348bd

Comment by James Wahlin [ 17/Apr/18 ]

This is caused because get_current_thread_name() in mongo.py wraps the thread name with quotes as per:
https://github.com/mongodb/mongo/blob/e0562dc07a6aaf2993f0236cc443ee9b83b5e522/buildscripts/gdb/mongo.py#L43-L44

We will need to strip the added quotes prior to inserting into the graphviz output as the first quote will be interpreted as the end of the "label" value.

Generated at Thu Feb 08 04:36:56 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.