aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2023-04-24 15:38:17 +0100
committerChristopher Baines <mail@cbaines.net>2023-04-24 15:38:17 +0100
commit99902f43804483b3b457ddd7cd574d3bb2485f0f (patch)
tree52d72abc3c475dd422c8ccefc71bb7b6186f0314
parentb090388c95798f52f6aacc33350da7da438c9106 (diff)
downloadbuild-coordinator-99902f43804483b3b457ddd7cd574d3bb2485f0f.tar
build-coordinator-99902f43804483b3b457ddd7cd574d3bb2485f0f.tar.gz
Expire database connection threads on exception
I'm concerned that SQLite is very sensitive to prepared statements being left around without being finalized or reset, and I think this can happen if an exception occurs in a worker, but before the reset or finalize happens. Handling this in every individual case would be quite difficult, but given that guile-sqlite finalizes prepared statements when you close a connection, I think that mechanism can be used to somewhat rigerously avoid this (at least for cached prepared statements).
-rw-r--r--guix-build-coordinator/datastore/sqlite.scm2
1 files changed, 2 insertions, 0 deletions
diff --git a/guix-build-coordinator/datastore/sqlite.scm b/guix-build-coordinator/datastore/sqlite.scm
index bcac7e6..90fd3b6 100644
--- a/guix-build-coordinator/datastore/sqlite.scm
+++ b/guix-build-coordinator/datastore/sqlite.scm
@@ -171,6 +171,7 @@ CREATE TABLE IF NOT EXISTS mem.build_allocation_plan (
(metric-increment writer-thread-destructor-counter)
(sqlite-close db)))
#:lifetime 500
+ #:expire-on-exception? #t
;; SQLite doesn't support parallel writes
#:parallelism 1
@@ -220,6 +221,7 @@ CREATE TABLE IF NOT EXISTS mem.build_allocation_plan (
(metric-increment reader-thread-destructor-counter)
(sqlite-close db)))
#:lifetime 50000
+ #:expire-on-exception? #t
;; Use a minimum of 2 and a maximum of 8 threads
#:parallelism