From 8dcc89df50c94a318805be05c7e62ed56725f99c Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Wed, 9 Jul 2025 12:53:02 +0100 Subject: [PATCH] Avoid choice-operation for the gc watcher In case this causes a memory leak. --- .../jobs/load-new-guix-revision.scm | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/guix-data-service/jobs/load-new-guix-revision.scm b/guix-data-service/jobs/load-new-guix-revision.scm index f9b35e9..81f84b3 100644 --- a/guix-data-service/jobs/load-new-guix-revision.scm +++ b/guix-data-service/jobs/load-new-guix-revision.scm @@ -23,6 +23,7 @@ #:use-module (ice-9 match) #:use-module (ice-9 threads) #:use-module (ice-9 format) + #:use-module (ice-9 atomic) #:use-module (ice-9 exceptions) #:use-module (ice-9 textual-ports) #:use-module (ice-9 hash-table) @@ -3456,8 +3457,8 @@ SKIP LOCKED") ignore-targets inferior-memory-limit parallelism) - (define finished-channel - (make-channel)) + (define finished? + (make-atomic-box #f)) (define job-not-found-exception (make-exception-with-message @@ -3504,13 +3505,8 @@ SKIP LOCKED") (/ (assq-ref stats 'heap-free-size) (expt 2. 20))))) - (when - (perform-operation - (choice-operation - (wrap-operation (get-operation finished-channel) - (const #f)) - (wrap-operation (sleep-operation 3) - (const #t)))) + (unless (atomic-box-ref finished?) + (sleep 3) (loop gc-times gc-time-taken)))))) @@ -3652,5 +3648,5 @@ WHERE revision_id = $1" "update-derivation-outputs-statistics" (update-derivation-outputs-statistics conn)))))) - (put-message finished-channel #t) + (atomic-box-set! finished? #t) result)