Home > database >  Mysql deadlock problem
Mysql deadlock problem

Time:10-06

Recent online server occasionally appear card phenomenon, through the show engine innodb status found LATEST DETECTED DEADLOCK
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
170814 11:27:05
* * * (1) the TRANSACTION:
19 ff19ca TRANSACTION, ACTIVE 0.315 SEC starting index read
Mysql tables in use 1, locked 1
The LOCK WAIT 5 LOCK struct (s), heap size 1248, 2 row LOCK (s), the undo log entries 1
LOCK BLOCKING MySQL thread id: 51016674 block 51259706
MySQL thread id 51259706, OS thread handle 0 x2b7e3a70e700, query id 2089979089 10.165.223.110:60058 hdypt Updating
update bpm_ProcessInstanceRuntime set tenantId=null, actionStatus=null, archived=0, bingAn=0, bpmServer='bpmServer1', businessKey='_QG9KgICUEeeNHIFbQ7T3Eg', created='2017-08-14 10:29:48', createrDN='cn=李斯,ou=海淀区人民政府,o=海淀区机关', createrName='李斯', createrUID='_iB60UDsPEeW1dsJRU-8AWA', debug=1, deleted=0, description=null, fromId=null, instanceExpireDate=null, instanceRemindDate=null, masterId='_QG9KgICUEeeNHIFbQ7T3Eg', name=null, parentId=null, priority=0, processId='_0rQw4dG8EeaQ_ZrvF2Kt-g', processName='政府收文', processVersion=-1, routeType=null, running=1, serialNumber=null, slaveIndex=0, state='RUNNING', step=2, title='关于以区政府名义印发"海淀区推进生活垃圾分类工作方案"的请示', updated='2017-08-14 11:26:37', updaterDN='cn=王振宇,ou=政府办信息公开科,ou=政府办,ou=政府系统,o=海淀区机关', updaterName='王?
* * * (1) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD the LOCKS space id 3760 page no 3291 n bits 104 index ` PRIMARY ` of table ` hdyptdb `. ` bpm_processinstanceruntime ` TRX id 19 ff19ca lock_mode X LOCKS rec but not gap waiting
* * * (2) the TRANSACTION:
19 ff19cc TRANSACTION, ACTIVE 0.314 SEC starting index read
Mysql tables in use 1, locked 1
7 the lock struct (s), the heap size of 1248, 3 row lock (s), the undo log entries 2
MySQL thread id 51016674, OS thread handle 0 x2b7f04a14700, query id 2089979118 10.165.223.110:34566 hdypt Updating
update bpm_ActivityInstanceRuntime set tenantId=null, activityId='_87aCING8EeaQ_ZrvF2Kt-g', activityInstanceExpireDate=null, activityInstanceId='_QG9KgYCUEeeNHIFbQ7T3Eg', activityInstanceRemindDate=null, bpmServer='bpmServer1', businessKey='_QG9KgYCUEeeNHIFbQ7T3Eg', created='2017-08-14 10:29:48', createrDN='cn=李斯,ou=海淀区人民政府,o=海淀区机关', createrName='李斯', createrUID='_iB60UDsPEeW1dsJRU-8AWA', deleted=0, description=null, explanation=null, fromActivityId='_9pSb0NG8EeaQ_ZrvF2Kt-g', fromId=null, fromTransitionId='_Qys8sNG9EeaQ_ZrvF2Kt-g', fromTransitionName='退回', maxStep=1, name='收文员收文', parentId=null, parentStep=0, priority=0, processId='_0rQw4dG8EeaQ_ZrvF2Kt-g', processVersion=-1, routeType=null, running=1, state='RUNNING', step=2, systemRoute=1, tabIndex=0, updated='2017-08-14 11:26:37', updaterDN='cn=王振宇,ou=政府办信息公开科,ou=政府办,ou
Doesn * * * (2) THE LOCK (S) :
RECORD the LOCKS space id 3760 page no 3291 n bits 104 index ` PRIMARY ` of table ` hdyptdb `. ` bpm_processinstanceruntime ` TRX id 19 ff19cc lock_mode X LOCKS rec but not gap
* * * (2) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD the LOCKS space id 1183 page no 12106 n bits 88 index ` PRIMARY ` of table ` hdyptdb `. ` bpm_activityinstanceruntime ` TRX id 19 ff19cc lock_mode X LOCKS rec but not gap waiting
* * * WE ROLL BACK the TRANSACTION (1)
-- -- -- -- -- -- -- -- -- -- -- --
The TRANSACTIONS

This is a deadlock part

And partly lock wait
19 ff496e - TRANSACTION, ACTIVE 2.051 SEC starting index read
Mysql tables in use 1, locked 1
The LOCK WAIT 2 LOCK struct (s), heap size 376, 1 row LOCK (s)
LOCK BLOCKING MySQL thread id: 17063906 block 50646154
MySQL thread id 50646154, OS thread handle 0 x2b7f061e6700, query id 2090444176 10.165.223.109:43597 hdypt statistics
select ticketgran0_.ID as ID34_0_, ticketgran0_.NUMBER_OF_TIMES_USED as NUMBER2_34_0_, ticketgran0_.CREATION_TIME as CREATION3_34_0_, ticketgran0_.EXPIRATION_POLICY as EXPIRATION4_34_0_, ticketgran0_.LAST_TIME_USED as LAST5_34_0_, ticketgran0_.PREVIOUS_LAST_TIME_USED as PREVIOUS6_34_0_, ticketgran0_.ticketGrantingTicket_ID as ticketG10_34_0_, ticketgran0_.AUTHENTICATION as AUTHENTI7_34_0_, ticketgran0_.EXPIRED as EXPIRED34_0_, ticketgran0_.SERVICES_GRANTED_ACCESS_TO as SERVICES9_34_0_ from CAS_TICKET_GRANTING_TICKET ticketgran0_ where ticketgran0_.ID='TGT-698-n52AJIetSrdTYyTk3HIWTlQTgp5nizwko7
-- -- -- -- -- -- -- TRX HAS had 2 SEC WAITING FOR THIS LOCK TO BE GRANTED:
RECORD the LOCKS space id 2766 page no 211413 n bits 72 index ` PRIMARY ` of table ` hdyptdb `. ` cas_ticket_granting_ticket ` TRX id 19 ff496e lock_mode X LOCKS rec but not gap waiting
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
The TABLE LOCK TABLE ` hdyptdb `. ` cas_ticket_granting_ticket ` TRX id 19 ff496e LOCK mode IX
RECORD the LOCKS space id 2766 page no 211413 n bits 72 index ` PRIMARY ` of table ` hdyptdb `. ` cas_ticket_granting_ticket ` TRX id 19 ff496e lock_mode X LOCKS rec but not gap waiting

Everyone a great god what method or to solve it for me?

CodePudding user response:

Lock mostly depends on application side to solve it, the server check notify the application side which statements wrong
  • Related