04-06-2022, 06:49 PM
Servers started reporting deadlocks a lot when making SQL updates. I've seen the occasional deadlock happen in the past without knowing the cause. The frequency of deadlocks seemed to increase a lot recently.
When a deadlock happens during an SQL transaction, the entire transaction fails.
The negative consequences of this event are many. One negative consequence is leaving players in limbo when they travel from one server to another, like when going through a wormhole.
A little research revealed the root cause of deadlocks during SQL UPDATE operations in PostgreSQL. The solution was trivial. It simply required a consistency of order when updating records by multiple processes. Updates are now performed in atom id order.
This requires a little time monitoring the server logs to be sure the problem is gone. So far so good. Logs are blissfully quiet.
When a deadlock happens during an SQL transaction, the entire transaction fails.
The negative consequences of this event are many. One negative consequence is leaving players in limbo when they travel from one server to another, like when going through a wormhole.
A little research revealed the root cause of deadlocks during SQL UPDATE operations in PostgreSQL. The solution was trivial. It simply required a consistency of order when updating records by multiple processes. Updates are now performed in atom id order.
This requires a little time monitoring the server logs to be sure the problem is gone. So far so good. Logs are blissfully quiet.