~ruther/guix-local

e9d632640beb03706b281cc2dbb1d46776d6a17d — Andreas Enge a month ago d12619f
gnu: Remove guile-fibers-1.0.

* gnu/packages/guile-xyz.scm (guile-fibers-1.0): Delete variable.
* gnu/packages/patches/guile-fibers-destroy-peer-schedulers.patch:
Remove file.
* gnu/local.mk (dist_patch_DATA): Unregister patch.

Change-Id: If2a85f8f2c19dc038691ffd6435dd60068b2898d
3 files changed, 0 insertions(+), 78 deletions(-)

M gnu/local.mk
M gnu/packages/guile-xyz.scm
D gnu/packages/patches/guile-fibers-destroy-peer-schedulers.patch
M gnu/local.mk => gnu/local.mk +0 -1
@@ 1542,7 1542,6 @@ dist_patch_DATA =						\
  %D%/packages/patches/guile-ac-d-bus-fix-tests.patch		\
  %D%/packages/patches/guile-lib-fix-tests-for-guile2.2.patch		\
  %D%/packages/patches/guile-fibers-cross-build-fix.patch 	\
  %D%/packages/patches/guile-fibers-destroy-peer-schedulers.patch \
  %D%/packages/patches/guile-fibers-epoll-instance-is-dead.patch \
  %D%/packages/patches/guile-fibers-fd-finalizer-leak.patch	\
  %D%/packages/patches/guile-fibers-wait-for-io-readiness.patch \

M gnu/packages/guile-xyz.scm => gnu/packages/guile-xyz.scm +0 -53
@@ 1248,59 1248,6 @@ is not available for Guile 2.0.")
     ;; <https://github.com/wingo/fibers/pull/53>.
     (filter (cut string-suffix? "-linux" <>) %supported-systems))))

(define-public guile-fibers-1.0
  (package
    (inherit guile-fibers-1.1)
    (version "1.0.0")
    (source (origin
              (method url-fetch)
              (uri (string-append "https://wingolog.org/pub/fibers/fibers-"
                                  version ".tar.gz"))
              (sha256
               (base32
                "0vjkg72ghgdgphzbjz9ig8al8271rq8974viknb2r1rg4lz92ld0"))
              (modules '((guix build utils)))
              (snippet
               '(begin
                  ;; Allow builds with Guile 3.0.
                  (substitute* "configure"
                    (("search=\"2\\.2\"")
                     "search=\"3.0 2.2\""))

                  ;; Explicitly include system headers rather than relying on
                  ;; <libguile.h> to do it for us.
                  (substitute* "epoll.c"
                    (("#include.*libguile\\.h.*$" all)
                     (string-append "#include <unistd.h>\n"
                                    "#include <string.h>\n"
                                    all "\n")))

                  ;; Import (ice-9 threads) for 'current-processor-count'.
                  (substitute* "tests/channels.scm"
                    (("#:use-module \\(fibers\\)")
                     (string-append "#:use-module (fibers)\n"
                                    "#:use-module (ice-9 threads)\n")))
                  #t))
              (patches
               ;; fixes a resource leak that causes crashes in the tests
               (search-patches "guile-fibers-destroy-peer-schedulers.patch"))))
    (arguments
     '(;; The code uses 'scm_t_uint64' et al., which are deprecated in 3.0.
       #:configure-flags '("CFLAGS=-Wno-error=deprecated-declarations")
       #:phases (modify-phases %standard-phases
                  (add-after 'install 'mode-guile-objects
                    (lambda* (#:key outputs #:allow-other-keys)
                      ;; .go files are installed to "lib/guile/X.Y/cache".
                      ;; This phase moves them to "…/site-ccache".
                      (let* ((out (assoc-ref outputs "out"))
                             (lib (string-append out "/lib/guile"))
                             (old (car (find-files lib "^ccache$"
                                                   #:directories? #t)))
                             (new (string-append (dirname old)
                                                 "/site-ccache")))
                        (rename-file old new)
                        #t))))))))

(define-public guile2.2-fibers
  (package
    (inherit guile-fibers)

D gnu/packages/patches/guile-fibers-destroy-peer-schedulers.patch => gnu/packages/patches/guile-fibers-destroy-peer-schedulers.patch +0 -24
@@ 1,24 0,0 @@
Fibers 1.0.0 has a bug in run-fibers in which peer schedulers aren't destroyed -
so if you had 4 cores, 1 would be destroyed when run-fibers returned, but the
other 3 would stay around.  Each scheduler uses 3 file descriptors, so for
machines with many cores, this resource leak adds up quickly - quickly enough
that the test suite can even fail because of it.

See https://github.com/wingo/fibers/issues/36.

This fixes that.  It should be safe to destroy the peer schedulers at the given
point because the threads that could be running them are all either dead or the
current thread.

As of May 21, 2020, this bug still existed in the 1.0.0 (latest) release and in
git master.
--- a/fibers.scm	2020-05-21 18:38:06.890690154 -0500
+++ b/fibers.scm	2020-05-21 18:38:56.395686693 -0500
@@ -137,5 +137,6 @@
              (%run-fibers scheduler hz finished? affinity))
            (lambda ()
              (stop-auxiliary-threads scheduler)))))
+      (for-each destroy-scheduler (scheduler-remote-peers scheduler))
       (destroy-scheduler scheduler)
       (apply values (atomic-box-ref ret))))))