summaryrefslogtreecommitdiff
path: root/buildscripts/gdb/mongo_lock.py
diff options
context:
space:
mode:
authorEddie Louie <eddie.louie@mongodb.com>2017-12-18 11:18:56 -0500
committerEddie Louie <eddie.louie@mongodb.com>2017-12-19 10:08:26 -0500
commit508a73f1acda5cd500e8edc3bfef7f29fc82cb99 (patch)
treea5ae3551b5e16f63a635958fc528bb32e48218a1 /buildscripts/gdb/mongo_lock.py
parent5a781806537d7710c3b895e450df2307b8861b69 (diff)
downloadmongo-508a73f1acda5cd500e8edc3bfef7f29fc82cb99.tar.gz
SERVER-31841 In find_mutex_holder handle when mutex_holder not found in thread_dict
Diffstat (limited to 'buildscripts/gdb/mongo_lock.py')
-rw-r--r--buildscripts/gdb/mongo_lock.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/buildscripts/gdb/mongo_lock.py b/buildscripts/gdb/mongo_lock.py
index 98dc66d8785..1d20ca8e0bc 100644
--- a/buildscripts/gdb/mongo_lock.py
+++ b/buildscripts/gdb/mongo_lock.py
@@ -218,12 +218,20 @@ def find_mutex_holder(graph, thread_dict, show):
mutex_value = mutex_this.value(frame)
# The mutex holder is a LWPID
mutex_holder = int(mutex_value["_M_mutex"]["__data"]["__owner"])
- mutex_holder_id = thread_dict[mutex_holder]
+ # At time thread_dict was initialized, the mutex holder may not have been found.
+ # Use the thread LWP as a substitute for showing output or generating the graph.
+ if mutex_holder not in thread_dict:
+ print("Warning: Mutex at {} held by thread with LWP {}"
+ " not found in thread_dict. Using LWP to track thread.".format(mutex_value,
+ mutex_holder))
+ mutex_holder_id = mutex_holder
+ else:
+ mutex_holder_id = thread_dict[mutex_holder]
(_, mutex_waiter_lwpid, _) = gdb.selected_thread().ptid
mutex_waiter_id = thread_dict[mutex_waiter_lwpid]
if show:
- print("Mutex at {} held by thread 0x{:x} (LWP {}) "
+ print("Mutex at {} held by thread 0x{:x} (LWP {})"
" waited on by thread 0x{:x} (LWP {})".format(mutex_value,
mutex_holder_id,
mutex_holder,