14

My code is a bit of a mess, I'm not sure where the problem is, but I'm getting deadlocks without using any transactions or table locking. Any information about this would help.

I've looked up deadlocks and it seems the only way to cause them is by using transactions.

Error Number: 1213
Deadlock found when trying to get lock; try restarting transaction
UPDATE `x__cf_request` SET `contact_success` = 1, `se_engine_id` = 0, `is_fresh` = 1 WHERE `id` =  '28488'

Edit: Why downvotes? It's a valid question. If it's impossible just say why, so that other people can see when they run into this issue.

Farzher
  • 13,934
  • 21
  • 69
  • 100
  • So lame that you were getting downvoted. I'm having a similar issue and your question is the closest I've found that needs an answer...let us know if you ever solved this! – Shane N Mar 09 '15 at 21:06

1 Answers1

2

In InnoDB each statement is run in a transation; BEGIN and autocommit=0 are used for multi-statement transactions. Having said that, the deadlock happens between different transactions.

It seems you don't have index on the id field, or more than one record have the same id. If not, than you have an index-gap locking in place. To diagnose further, you need to provide the output of SHOW ENGINE InnoDB STATUS

Maxim Krizhanovsky
  • 26,265
  • 5
  • 59
  • 89