This is an automated email from the git hooks/post-receive script.
cbaines pushed a commit to branch master
in repository data-service.
The following commit(s) were added to refs/heads/master by this push:
new 96b65f1 Avoid fiber deadlocks
96b65f1 is described below
commit 96b65f16fb2a6f5d568d7709a86e2307ef70fe0f
Author: Christopher Baines <[email protected]>
AuthorDate: Sun Oct 4 10:18:53 2020 +0100
Avoid fiber deadlocks
Channels don't represent some channel on which messages travel, at least
not a
very long one because it can't accommodate any messages. They simply
represent
a direct exchange of the message between a sender and receiver. Because of
this, put-message blocks the fiber, and if all the threads on the other end
are waiting for replies to be received, then you have a deadlock.
To avoid this situation, spawn new fibers to send the messages. I think this
works at least, although I'm unsure how sensible it is.
---
guix-data-service/utils.scm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/guix-data-service/utils.scm b/guix-data-service/utils.scm
index 855c819..c50cb64 100644
--- a/guix-data-service/utils.scm
+++ b/guix-data-service/utils.scm
@@ -99,7 +99,9 @@
(define (defer-to-thread-pool-channel thunk)
(make-thread-pool-channel!)
(let ((reply (make-channel)))
- (put-message %thread-pool-channel (cons reply thunk))
+ (spawn-fiber
+ (lambda ()
+ (put-message %thread-pool-channel (cons reply thunk))))
reply))
(define (fetch-result-of-defered-thunk reply-channel)