Database Deadlocks
I have had to explain database deadlocks several times and I had this old code project to produce a database deadlock and I had the following scheme for explanation:
However it was a bit too little or too confusing to get the idea through sometimes, so I retired the project and recreated a new one on the newest Symfony. It runs on Docker and produces a deadlock by running just one command. It’s on Github: https://github.com/varfrog/deadlock-symfony.
The main point is that a deadlock happens when the same records are being locked by different processes in a different sequence. More on this in the README of the project.