# Deadlock after upgrading to 5.7 from 5.6

**URL:** <https://forums.percona.com/t/deadlock-after-upgrading-to-5-7-from-5-6/7068>\
**Category:** Percona Server for MySQL 5.7\
**Created:** [June 19, 2019, 7:45pm UTC](https://forums.percona.com/t/deadlock-after-upgrading-to-5-7-from-5-6/7068 "2019-06-19T19:45:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pooja.gupta](https://avatars.discourse-cdn.com/v4/letter/p/258eb7/32.png) [@pooja.gupta](https://forums.percona.com/u/pooja.gupta)\
**Post date:** [June 19, 2019, 7:45pm UTC](https://forums.percona.com/t/deadlock-after-upgrading-to-5-7-from-5-6/7068/1 "2019-06-19T19:45:02Z")

</div>

Hi,

We are started facing deadlock issue very frequently after upgrading to 5.7

There are no changes in application and application was running fine before upgrade.

Version: | 5.7.25-28-log |

Latest Deadlock from innodb status:

* * *

## LATEST DETECTED DEADLOCK

2019-06-20 10:49:01 0x7fd7d7919700  
[LIST]  
[_]  
[LIST]  
[_]  
[LIST]  
\* TRANSACTION:  
TRANSACTION 76157437744, ACTIVE 0 sec inserting  
mysql tables in use 1, locked 1  
LOCK WAIT 3 lock struct(s), heap size 1136, 2 row lock(s), undo log entries 1  
MySQL thread id 5999151, OS thread handle 140565033457408, query id 1157758472 10.72.30.174 morpheus\_write update  
INSERT INTO `targets` (`campaignid`, `targetkey`, `priority`, `destination`, `status`, `nextattempt`) VALUES (‘166369’, ‘RT-API-1560991741.5838-5d0ad7fd8e968’, 1, ‘0452162373’, ‘READY’, NULL) ON DUPLICATE KEY UPDATE `targetid` = LAST\_INSERT\_ID(`targetid`), `destination` = VALUES(`destination`)  
\* WAITING FOR THIS LOCK TO BE GRANTED:  
RECORD LOCKS space id 210 page no 7923783 n bits 144 index campaignid of table `morpheus`.`targets` trx id 76157437744 lock\_mode X locks gap before rec insert intention waiting  
\* TRANSACTION:  
TRANSACTION 76157437737, ACTIVE 0 sec inserting  
mysql tables in use 1, locked 1  
4 lock struct(s), heap size 1136, 3 row lock(s), undo log entries 1  
MySQL thread id 5999154, OS thread handle 140565011339008, query id 1157758444 10.72.30.174 morpheus\_write update  
INSERT INTO `targets` (`campaignid`, `targetkey`, `priority`, `destination`, `status`, `nextattempt`) VALUES (‘166369’, ‘RT-API-1560991741.5748-5d0ad7fd8c59b’, 1, ‘0447272344’, ‘READY’, NULL) ON DUPLICATE KEY UPDATE `targetid` = LAST\_INSERT\_ID(`targetid`), `destination` = VALUES(`destination`)  
\* HOLDS THE LOCK(S):  
RECORD LOCKS space id 210 page no 7923783 n bits 144 index campaignid of table `morpheus`.`targets` trx id 76157437737 lock\_mode X locks gap before rec  
\* WAITING FOR THIS LOCK TO BE GRANTED:  
RECORD LOCKS space id 210 page no 7923783 n bits 144 index campaignid of table `morpheus`.`targets` trx id 76157437737 lock\_mode X locks gap before rec insert intention waiting  
[\*]WE ROLL BACK TRANSACTION (1)  
------------  
[/LIST]  
[/LIST]  
[/LIST]
