Avoid choice-operation for the gc watcher

In case this causes a memory leak.
This commit is contained in:
Christopher Baines 2025-07-09 12:53:02 +01:00
parent 42ac51212f
commit 8dcc89df50

View file

@ -23,6 +23,7 @@
#:use-module (ice-9 match) #:use-module (ice-9 match)
#:use-module (ice-9 threads) #:use-module (ice-9 threads)
#:use-module (ice-9 format) #:use-module (ice-9 format)
#:use-module (ice-9 atomic)
#:use-module (ice-9 exceptions) #:use-module (ice-9 exceptions)
#:use-module (ice-9 textual-ports) #:use-module (ice-9 textual-ports)
#:use-module (ice-9 hash-table) #:use-module (ice-9 hash-table)
@ -3456,8 +3457,8 @@ SKIP LOCKED")
ignore-targets ignore-targets
inferior-memory-limit inferior-memory-limit
parallelism) parallelism)
(define finished-channel (define finished?
(make-channel)) (make-atomic-box #f))
(define job-not-found-exception (define job-not-found-exception
(make-exception-with-message (make-exception-with-message
@ -3504,13 +3505,8 @@ SKIP LOCKED")
(/ (assq-ref stats 'heap-free-size) (/ (assq-ref stats 'heap-free-size)
(expt 2. 20))))) (expt 2. 20)))))
(when (unless (atomic-box-ref finished?)
(perform-operation (sleep 3)
(choice-operation
(wrap-operation (get-operation finished-channel)
(const #f))
(wrap-operation (sleep-operation 3)
(const #t))))
(loop gc-times (loop gc-times
gc-time-taken)))))) gc-time-taken))))))
@ -3652,5 +3648,5 @@ WHERE revision_id = $1"
"update-derivation-outputs-statistics" "update-derivation-outputs-statistics"
(update-derivation-outputs-statistics conn)))))) (update-derivation-outputs-statistics conn))))))
(put-message finished-channel #t) (atomic-box-set! finished? #t)
result) result)