Simply reading from a sqlite database can crash with BUSY if there's another connection performing a write at the same time.
I noticed these problems when using persistent-sqlite with multiple processes that do heavy read+write to a shared database. It's probably much less evident if using sqlite in the backend of a website that doesn't involve many writes.
I don't have experience with yesod's use of persistent, so I don't know if yesod sites have this problem. If yesod opens a single connection to the database, and all threads use this connection, that would avoid the problem. If each thread opens a new database connection, yesod sites would be affected.
The solution seems to be WAL mode. http://www.sqlite.org/wal.html
I think that persistent-sqlite should at least make it easy to enter WAL mode and document that it makes things more robust. But really, does it make sense for it to not use WAL mode by default?
I expected this stuff to be solid, not apparently solid until you put it under load.
Simply reading from a sqlite database can crash with BUSY if there's another connection performing a write at the same time.
I noticed these problems when using persistent-sqlite with multiple processes that do heavy read+write to a shared database. It's probably much less evident if using sqlite in the backend of a website that doesn't involve many writes.
I don't have experience with yesod's use of persistent, so I don't know if yesod sites have this problem. If yesod opens a single connection to the database, and all threads use this connection, that would avoid the problem. If each thread opens a new database connection, yesod sites would be affected.
The solution seems to be WAL mode. http://www.sqlite.org/wal.html
I think that persistent-sqlite should at least make it easy to enter WAL mode and document that it makes things more robust. But really, does it make sense for it to not use WAL mode by default?
I expected this stuff to be solid, not apparently solid until you put it under load.