How to avoid MySQL ‘Deadlock found when trying to get lock; try restarting transaction’

One easy trick that can help with most deadlocks is sorting the operations in a specific order. You get a deadlock when two transactions are trying to lock two locks at opposite orders, ie: connection 1: locks key(1), locks key(2); connection 2: locks key(2), locks key(1); If both run at the same time, connection 1 … Read more

What’s the difference between deadlock and livelock?

Taken from http://en.wikipedia.org/wiki/Deadlock: In concurrent computing, a deadlock is a state in which each member of a group of actions, is waiting for some other member to release a lock A livelock is similar to a deadlock, except that the states of the processes involved in the livelock constantly change with regard to one another, … Read more