diff options
author | Mathieu Othacehe <othacehe@gnu.org> | 2020-09-18 10:53:52 +0200 |
---|---|---|
committer | Mathieu Othacehe <othacehe@gnu.org> | 2020-09-18 11:02:44 +0200 |
commit | e7bebbe3d4bbd9103b8a2e71e62dfbaef9a928ab (patch) | |
tree | 9bbc6c92ce01ae3a8384c6f93405a348eafb2d33 | |
parent | 9a60cd6619df1bf1781dc47fbcc05c14994473fb (diff) | |
download | cuirass-e7bebbe3d4bbd9103b8a2e71e62dfbaef9a928ab.tar cuirass-e7bebbe3d4bbd9103b8a2e71e62dfbaef9a928ab.tar.gz |
Fix GC race-condition in spawn-builds.
If a derivation is GC'd just before calling "spawn-builds",
"build-derivations: will throw an exception that will be catched. Then,
"update-build-statuses!" will call "derivation-path->output-paths" that will
throw another exception because the derivation does not exit. This exception
is not handled, causing Cuirass to crash.
2020-09-18T10:41:18 batch of builds (partially) failed: build of `/gnu/store/zrmxzjf025nc89a7vdy5i94zavprc7fs-emacs-guix-0.5.2-2.58a840d.drv' failed (status: 1)
Backtrace:
In ice-9/boot-9.scm:
1736:10 11 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _)
In unknown file:
10 (apply-smob/0 #<thunk 7ffff5cbd4a0>)
In ice-9/boot-9.scm:
718:2 9 (call-with-prompt _ _ #<procedure default-prompt-handler (k proc)>)
In ice-9/eval.scm:
619:8 8 (_ #(#(#<directory (guile-user) 7ffff58f8f00>)))
In ice-9/boot-9.scm:
2806:4 7 (save-module-excursion _)
4351:12 6 (_)
In cuirass/base.scm:
562:10 5 (spawn-builds #<store-connection 256.99 7fffec03f910> _ #:max-batch-size _)
In srfi/srfi-1.scm:
634:9 4 (for-each #<procedure update! (drv)> ("/gnu/store/zrmxzjf025nc89a7vdy5i94zavprc7fs-emacs-guix-0.5.2-2.58a840d.drv"))
In cuirass/base.scm:
474:4 3 (update! "/gnu/store/zrmxzjf025nc89a7vdy5i94zavprc7fs-emacs-guix-0.5.2-2.58a840d.drv")
In guix/derivations.scm:
552:17 2 (derivation-path->output-paths "/gnu/store/zrmxzjf025nc89a7vdy5i94zavprc7fs-emacs-guix-0.5.2-2.58a840d.drv")
In ice-9/ports.scm:
440:11 1 (call-with-input-file "/gnu/store/zrmxzjf025nc89a7vdy5i94zavprc7fs-emacs-guix-0.5.2-2.58a840d.drv" #<procedure read-derivation (drv-port #:optional read-derivation-from-file)> #:binary _ …)
In unknown file:
0 (open-file "/gnu/store/zrmxzjf025nc89a7vdy5i94zavprc7fs-emacs-guix-0.5.2-2.58a840d.drv" "r" #:encoding #f #:guess-encoding #f)
* src/cuirass/base.scm (update-build-statuses!): Catch
"derivation-path->output-paths" exceptions and set the build status to
"failed".
-rw-r--r-- | src/cuirass/base.scm | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/cuirass/base.scm b/src/cuirass/base.scm index ec1b467..bce151a 100644 --- a/src/cuirass/base.scm +++ b/src/cuirass/base.scm @@ -471,14 +471,17 @@ build products." been passed to 'build-derivations' (meaning that we can assume that, if their outputs are invalid, that they failed to build.)" (define (update! drv) - (match (derivation-path->output-paths drv) + (match (false-if-exception + (derivation-path->output-paths drv)) (((_ . outputs) ...) (if (any (cut valid-path? store <>) outputs) (set-build-successful! drv) (db-update-build-status! drv (if (log-file store drv) (build-status failed) - (build-status failed-dependency))))))) + (build-status failed-dependency))))) + (else + (db-update-build-status! drv (build-status failed))))) (for-each update! lst)) |