Clear out cached store connections in the load revision inferior

These cached store connections have caches associated with them, that take up
lots of memory, leading to the inferior crashing. This change seems to help.
This commit is contained in:
Christopher Baines 2022-05-07 09:55:13 +01:00
parent 9607bcedfe
commit ff116d5e64

View file

@ -731,17 +731,30 @@ WHERE job_id = $1")
(round
(/ (assoc-ref (gc-stats) 'heap-size)
(expt 2. 20))))
(with-time-logging
(simple-format #f "getting derivations for ~A" system-target-pair)
(catch
'match-error
(lambda ()
(inferior-eval '(invalidate-derivation-caches!) inf))
(lambda (key . args)
(simple-format
(current-error-port)
"warning: ignoring match-error from calling inferior invalidate-derivation-caches!\n")))
(inferior-eval-with-store inf store (proc packages (list system-target-pair)))))
(format (current-error-port)
"inferior heap size: ~a MiB~%"
(round
(/ (inferior-eval '(assoc-ref (gc-stats) 'heap-size) inf)
(expt 2. 20))))
(let ((derivations
(with-time-logging
(simple-format #f "getting derivations for ~A" system-target-pair)
(catch
'match-error
(lambda ()
(inferior-eval '(invalidate-derivation-caches!) inf))
(lambda (key . args)
(simple-format
(current-error-port)
"warning: ignoring match-error from calling inferior invalidate-derivation-caches!\n")))
(inferior-eval-with-store inf store (proc packages (list system-target-pair))))))
;; Clean the cached store connections, as there are caches associated
;; with these that take up lots of memory
(inferior-eval '(when (defined? '%store-table) (hash-clear! %store-table)) inf)
derivations))
(append supported-system-pairs
supported-system-cross-build-pairs)))