[PATCH] Fix futures, %worker-count shouldn't be zero to prevent halting
Nala Ginrut <[email protected]> Thu, 14 Aug 2025 22:04:49 +0900
| Newsgroups | gmane.lisp.guile.devel |
|---|---|
| Message-ID | <CAPjoZoc=XQ3OQ722FWYU+t6Kexc9yjExN2ox_zgfjH59fk9UwA@mail.gmail.com> |
Hi folks! When I was trying to fix a halting bug in GNU Artanis' new runner module based on futures for async requests. I found it doesn't work for my cloud server which has only one CPU. The reason is because the%worker-count will be zero when there's only one cpu. So it will do nothing for the existing futures in the queue. The proper fix should be always keep %worker-count when there's just one cpu. It was tested successfully on my server machine. Attached the patch. Thanks!
0001-Fix-futures-worker-count-shouldn-t-be-zero-to-preven.patch
(text/x-patch, 790 B)
From e675b77a1c7de7ca03566a1f71ac75ea3ed24cb1 Mon Sep 17 00:00:00 2001 From: Nala Ginrut <[email protected]> Date: Thu, 14 Aug 2025 21:37:42 +0900 Subject: [PATCH] Fix futures, %worker-count shouldn't be zero to prevent halting --- module/ice-9/futures.scm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/module/ice-9/futures.scm b/module/ice-9/futures.scm index 4a462839a..a830858b0 100644 --- a/module/ice-9/futures.scm +++ b/module/ice-9/futures.scm @@ -264,7 +264,9 @@ adding it to the waiter queue." (define %worker-count (if (provided? 'threads) - (- (current-processor-count) 1) + (if (= 1 (current-processor-count)) + 1 + (- (current-processor-count) 1)) 0)) ;; A dock of workers that stay here forever. -- 2.43.0