Fundraising/Internal-facing/CiviCRM/Debugging deadlocks
When you see a deadlock-related failmail, you can check for the query using innotop on the civi server.
innotop -h fundraisingdb-write.wmnet
Then use Q to get all the queries, and see what's the connection id and how long this query lasting, you can use ? to get all the action list, The query list after clicked Q should show the connection ID and the start of the text of the query. Our systemtools extension should prefix the query text with a user ID
/* User : 161 */
to let you know who kicked the query off. To find the corresponding user, load this URL with the ID appended:
https://civicrm.wikimedia.org/civicrm/admin/user/#?User1=
You can then use
civicrm_query_killer -q <connection ID>
to stop the offending query.