[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Ludovic Courtès |
Date: |
Tue, 30 Jan 2018 18:02:45 -0500 (EST) |
branch: master
commit 161d6abef81784a1adb460d5bba40e03b627ceb2
Author: Ludovic Courtès <address@hidden>
Date: Tue Jan 30 23:58:47 2018 +0100
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).
---
src/cuirass/base.scm | 10 ++++++++++
1 file changed, 10 insertions(+)
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