Sometimes, the Records API returns this error when saving a record:
"error returned from database: 1213 (40001): Deadlock found when trying to get lock; try restarting transaction"
This has something to do with the way we acquire locks to the database, eg. here.