Databases
Database deadlocks: why they happen and how to recover
A deadlock is a cycle in which two or more transactions wait for locks held by one another, so none can proceed. Unlike ordinary lock contention, waiting alone cannot resolve a cycle. PostgreSQL detects the cycle, cancels one involved transaction, and lets the others continue. An application must be able to retry the canceled transaction safely.