Identify Deadlocks
Explore how to identify deadlocks by analyzing Linux core dumps. Understand how to list thread stack traces, examine mutex ownership, and investigate exception handling to diagnose deadlock causes in multi-threaded applications.
Deadlocks occur frequently in the absence of proper concurrency management. In this lesson, we’ll see how to identify them from the core dump.
Application source code
For reference, here’s the code of this application:
Loading the core dump
Start by loading the core dump:
gdb -c App11.core.594 -se App11
The above command will output the following to the terminal:
Listing all thread stacks
We can list all the thread stack traces and identify possible wait chains and deadlocks.
thread apply all bt
The above command will output the following to the terminal:
We see that Thread 3 and Thread 5 are waiting ...