mardi 2 mai 2017

SQLite3 DB starts throwing SQLException on write after a few days in production

We have a small internal Ruby on Rails service that uses a SQLite 3 database. After running perfectly for a few days, it starts throwing the following exception when attempting to save a model:

ActiveRecord::StatementInvalid (SQLite3::SQLException: cannot start a transaction within a transaction: begin transaction)

The Ruby code that throws this error is a simple:

@rule.save

where a rule is a model we want to save to the database.

Once this error starts occurring, we are no longer able to write to the sqlite database via the Rails app. After restarting the app, it works again for a few days.

Since restarting the Rails app seems to fix the issue, I can only guess that somehow it is keeping a database transaction open. I did not write this app and am new to Ruby. What could cause this and what would the best way to diagnose the issue be?

Aucun commentaire:

Enregistrer un commentaire