summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-01-30 23:58:47 +0100
committerLudovic Courtès <ludo@gnu.org>2018-01-30 23:58:47 +0100
commit161d6abef81784a1adb460d5bba40e03b627ceb2 (patch)
tree3eef61588ba82b3ab83aa7d20464bf2d3f8fc8d8 /src
parentexamples: Add 'random-jobs'. (diff)
downloadcuirass-161d6abef81784a1adb460d5bba40e03b627ceb2.tar.gz
base: Work around Fibers I/O scheduling bug.
Works around <https://github.com/wingo/fibers/issues/19>. The effect in practice would be that we'd usually not reach the 'close-pipe' call in 'evaluate', leaving zombie processes behind us, never executing the continuation, and additionally spinning fast on a sequence of epoll_wait/epoll_ctl calls. * src/cuirass/base.scm <top level>: Monkey-patch (fibers internal).
Diffstat (limited to 'src')
-rw-r--r--src/cuirass/base.scm10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/cuirass/base.scm b/src/cuirass/base.scm
index 510b155..aacfb92 100644
--- a/src/cuirass/base.scm
+++ b/src/cuirass/base.scm
@@ -204,6 +204,16 @@ fibers."
((? string? data)
(call-with-input-string data read))))
+(match (resolve-module '(fibers internal) #t #f #:ensure #f)
+ (#f #t) ;Fibers > 1.0.0
+ ((? module? internal) ;Fibers <= 1.0.0
+ ;; Work around <https://github.com/wingo/fibers/issues/19>.
+ ;; This monkey-patching aims to replace EPOLLERR occurrences in
+ ;; 'schedule-fibers-for-fd' with EPOLLERR | EPOLLHUP.
+ (module-define! internal 'EPOLLERR
+ (logior (@ (fibers epoll) EPOLLERR)
+ (@ (fibers epoll) EPOLLHUP)))))
+
(define (evaluate store db spec)
"Evaluate and build package derivations. Return a list of jobs."
(let* ((port (non-blocking-port