Database Lock tracebacks
Posted by Apostate on 03/23/19
Now this hopefully isn't happening to people very often, but every once in a great while you might get a traceback saying the database is locked. The tl;dr for this is you can ignore it and do the command again a few seconds later, and it'll probably be okay. And when we change to a different database type, it'll stop happening. Though if you're curious what's happening, here's the long version:
The database type we use doesn't handle concurrency- what this means is that it is fine for things happening sequentially, but if multiple things try to write the database at exactly the same time, it can't do that, and one will be blocked. With a player base of 30, that would almost never happen, but with a player base of 500, it has become an increasing issue, and we'll have to change from a Sqlite database to Postgres to handle concurrency and prevent any kind of locks, but that is very much not a trivial change. So we will do it eventually, but we tolerate a small number of database locks right now in the meantime until we invest in that.
The database type we use doesn't handle concurrency- what this means is that it is fine for things happening sequentially, but if multiple things try to write the database at exactly the same time, it can't do that, and one will be blocked. With a player base of 30, that would almost never happen, but with a player base of 500, it has become an increasing issue, and we'll have to change from a Sqlite database to Postgres to handle concurrency and prevent any kind of locks, but that is very much not a trivial change. So we will do it eventually, but we tolerate a small number of database locks right now in the meantime until we invest in that.