Index: lock-queue.scm ================================================================== --- lock-queue.scm +++ lock-queue.scm @@ -47,24 +47,36 @@ run_lock TEXT, CONSTRAINT runlock_constraint UNIQUE (run_lock));"))) (sqlite3:set-busy-handler! db handler) db)) -(define (lock-queue:set-state db test-id newstate) +(define (lock-queue:set-state db test-id newstate #!key (remtries 10)) (handle-exceptions exn - (thread-sleep! 30) - (lock-queue:set-state db test-id newstate) + (if (> remtries 0) + (begin + (debug:print 0 "WARNING: exception on lock-queue:set-state. Trying again in 30 seconds.") + (thread-sleep! 30) + (lock-queue:set-state db test-id newstate remtries: (- remtries 1))) + (begin + (debug:print 0 "ERROR: Failed to set lock state for test with id " test-id ", error: " ((condition-property-accessor 'exn 'message) exn) ", giving up.") + #f)) (sqlite3:execute db "UPDATE queue SET state=? WHERE test_id=?;" newstate test-id))) -(define (lock-queue:any-younger? db mystart test-id) +(define (lock-queue:any-younger? db mystart test-id #!key (remtries 10)) (handle-exceptions exn - (thread-sleep! 30) - (lock-queue:any-younger? db mystart test-id) + (if (> remtries 0) + (begin + (debug:print 0 "WARNING: exception on lock-queue:any-younger. Trying again in 30 seconds.") + (thread-sleep! 30) + (lock-queue:any-younger? db mystart test-id remtries: (- remtries 1))) + (begin + (debug:print 0 "ERROR: Failed to find younger locks for test with id " test-id ", error: " ((condition-property-accessor 'exn 'message) exn) ", giving up.") + #f)) (let ((res #f)) (sqlite3:for-each-row (lambda (tid) ;; Actually this should not be needed as mystart cannot be simultaneously less than and test-id same as (if (not (equal? tid test-id)) Index: tdb.scm ================================================================== --- tdb.scm +++ tdb.scm @@ -55,11 +55,12 @@ (handle-exceptions exn (begin (debug:print 2 "ERROR: problem accessing test db " work-area ", you probably should clean and re-run this test" ((condition-property-accessor 'exn 'message) exn)) - (set! db (sqlite3:open-database ":memory:"))) ;; open an in-memory db to allow readonly access + (set! db (sqlite3:open-database ":memory:")) ;; open an in-memory db to allow readonly access + (set! dbexists #f)) ;; must force re-creation of tables, more tom-foolery (set! db (sqlite3:open-database dbpath))) (if *db-write-access* (sqlite3:set-busy-handler! db handler)) (if (not dbexists) (begin (sqlite3:execute db "PRAGMA synchronous = FULL;")