Index: dbfile.scm ================================================================== --- dbfile.scm +++ dbfile.scm @@ -451,10 +451,14 @@ (assert (>= tries-left 0) (conc "FATAL: Five attempts in dbfile:cautious-open-database of "fname", giving up.")) (if (and (file-write-access? fname) (not (dbfile:simple-file-lock lock-file))) (begin (dbfile:print-err "INFO: dbfile:cautious-open-database: lock file " lock-file " exists, trying again in 1 second.") (thread-sleep! 1) + (if (eq? tries-left 2) + (begin + (dbfile:print-err "INFO: stealing the lock "lock-file) + (delete-file lock-file))) (dbfile:cautious-open-database fname init-proc (- tries-left 1))) (let* ((db-exists (file-exists? fname)) (result (condition-case (let* ((db (sqlite3:open-database fname))) (if (and init-proc (not db-exists))