gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet-scheme] 02/02: guix: Add required fibers patch.


From: gnunet
Subject: [gnunet-scheme] 02/02: guix: Add required fibers patch.
Date: Wed, 27 Jul 2022 17:18:05 +0200

This is an automated email from the git hooks/post-receive script.

maxime-devos pushed a commit to branch master
in repository gnunet-scheme.

commit aa6ca121942680a02599ad99fd369e806d087a48
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Wed Jul 27 17:16:31 2022 +0200

    guix: Add required fibers patch.
    
    This addresses the ‘epoll instance is dead’ test failures.
    
    * doc/contributing.tm: Add link to upstream patch.
    * guile-fibers-epoll-instance-is-dead.patch: New file.
    * guix.scm (guile-fibers-1.1/fixed): Define package variant using new
    file, and ...
    (scheme-gnunet): ... use it!
---
 doc/contributing.tm                       |  7 ++-
 guile-fibers-epoll-instance-is-dead.patch | 99 +++++++++++++++++++++++++++++++
 guix.scm                                  | 12 +++-
 3 files changed, 113 insertions(+), 5 deletions(-)

diff --git a/doc/contributing.tm b/doc/contributing.tm
index 67a4f76..0a8863e 100644
--- a/doc/contributing.tm
+++ b/doc/contributing.tm
@@ -24,15 +24,16 @@
     (pfds)|https://github.com/ijp/pfds/>
 
     <item><hlink|(Guile) Fibers|https://github.com/wingo/fibers/>, with the
-    <slink|https://github.com/wingo/fibers/pull/50> patch
+    patches from <slink|https://github.com/wingo/fibers/pull/50> and
+    <slink|https://github.com/wingo/fibers/pull/62/>.
 
     
<item><hlink|Guile-QuickCheck|https://ngyro.com/software/guile-quickcheck.html>
 
     <item><hlink|Guile-Gcrypt|https://notabug.org/cwebber/guile-gcrypt>
   </itemize>
 
-  A few bug fixes to Guile are required that might not yet be included in
-  your distribution, see <verbatim|guix.scm>
+  A few bug fixes to Guile and Guile Fibers are required that might not yet
+  be included in your distribution, see <verbatim|guix.scm>
 
   Users of <hlink|GNU Guix|https://guix.gnu.org><index|Guix> can run
   <shell|guix shell -D -f guix.scm> in the checkout to create an environment
diff --git a/guile-fibers-epoll-instance-is-dead.patch 
b/guile-fibers-epoll-instance-is-dead.patch
new file mode 100644
index 0000000..ba191f7
--- /dev/null
+++ b/guile-fibers-epoll-instance-is-dead.patch
@@ -0,0 +1,99 @@
+From 5db4077e9f5166033637d2af9532ec6144b85646 Mon Sep 17 00:00:00 2001
+From: Maxime Devos <maximedevos@telenet.be>
+Date: Thu, 30 Jun 2022 14:21:47 +0000
+Subject: [PATCH 1/2] Fix behaviour of 'epoll-wake!' after 'run-fibers'.
+
+This avoids the "epoll instance is dead" error noticed in
+GNUnet-Scheme's test suite, as reported at
+<https://github.com/wingo/fibers/issues/61>.
+A test is added in the next commit.
+
+This patch has been applied upstream, but there hasn't been
+a new release yet at time of writing.
+
+* fibers/epoll.scm (epoll-wake!)[dead]: Instead of throwing an error,
+just return #t.
+---
+ fibers/epoll.scm | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/fibers/epoll.scm b/fibers/epoll.scm
+index d26db4d..eb63242 100644
+--- a/fibers/epoll.scm
++++ b/fibers/epoll.scm
+@@ -1,6 +1,7 @@
+ ;; epoll
+ 
+ ;;;; Copyright (C) 2016 Andy Wingo <wingo@pobox.com>
++;;;; Copyright (C) 2022 Maxime Devos <maximedevos@telenet.be>
+ ;;;; 
+ ;;;; This library is free software; you can redistribute it and/or
+ ;;;; modify it under the terms of the GNU Lesser General Public
+@@ -135,7 +136,12 @@ epoll wait (if appropriate)."
+     ('waiting
+      (primitive-epoll-wake (fileno (epoll-wake-write-pipe epoll))))
+     ('not-waiting #t)
+-    ('dead (error "epoll instance is dead"))))
++    ;; This can happen if a fiber was waiting on a condition and
++    ;; run-fibers completes before the fiber completes and afterwards
++    ;; the condition is signalled.  In that case, we don't have to
++    ;; resurrect the fiber or something, we can just do nothing.
++    ;; (Bug report: https://github.com/wingo/fibers/issues/61)
++    ('dead #t)))
+ 
+ (define (epoll-default-folder fd events seed)
+   (acons fd events seed))
+
+From c01d3853eb56ea4adacc31f51f6e917f8c0abe1c Mon Sep 17 00:00:00 2001
+From: Maxime Devos <maximedevos@telenet.be>
+Date: Thu, 30 Jun 2022 14:18:36 +0000
+Subject: [PATCH 2/2] Test for issue #61.
+
+* tests/conditions.scm: Add a test.
+---
+ tests/conditions.scm | 20 ++++++++++++++++++++
+ 1 file changed, 20 insertions(+)
+
+diff --git a/tests/conditions.scm b/tests/conditions.scm
+index 505c42a..179605a 100644
+--- a/tests/conditions.scm
++++ b/tests/conditions.scm
+@@ -1,6 +1,7 @@
+ ;; Fibers: cooperative, event-driven user-space threads.
+ 
+ ;;;; Copyright (C) 2016 Free Software Foundation, Inc.
++;;;; Copyright (C) 2022 Maxime Devos <maximedevos@telenet.be>
+ ;;;;
+ ;;;; This library is free software; you can redistribute it and/or
+ ;;;; modify it under the terms of the GNU Lesser General Public
+@@ -21,6 +22,7 @@
+   #:use-module (fibers)
+   #:use-module (fibers conditions)
+   #:use-module (fibers operations)
++  #:use-module (fibers scheduler)
+   #:use-module (fibers timers))
+ 
+ (define failed? #f)
+@@ -78,4 +80,22 @@
+                              (wait cv)
+                              #t))
+ 
++;; Make a condition, wait for it inside a fiber, let the fiber abruptly
++;; terminate and signal the condition afterwards.  This tests for the bug
++;; noticed at <https://github.com/wingo/fibers/issues/61>.
++(assert-equal #t
++            (let ((cv (make-condition)))
++              (run-fibers
++               (lambda ()
++                 (spawn-fiber (lambda () (wait cv)))
++                 (yield-current-task)) ; let the other fiber wait forever
++               ;; This test relies on not draining -- this is the default,
++               ;; but let's make this explicit.
++               #:drain? #false ;
++               ;; For simplicity, disable concurrency and preemption.
++               ;; That way, we can use 'yield-current-task' instead of an
++               ;; arbitrary sleep time.
++               #:hz 0 #:parallelism 1)
++              (signal-condition! cv)))
++
+ (exit (if failed? 1 0))
diff --git a/guix.scm b/guix.scm
index d05ce8c..59e544e 100644
--- a/guix.scm
+++ b/guix.scm
@@ -37,6 +37,14 @@
 
 (define %source-dir (dirname (current-filename)))
 
+(define guile-fibers-1.1/fixed
+  (package
+   (inherit
+    (package-with-extra-patches
+     guile-fibers-1.1
+     (list (local-file "guile-fibers-epoll-instance-is-dead.patch"))))
+   (arguments (list #:tests? #false)))) ; long test times, not worth it
+
 (define-public scheme-gnunet
   (package
    (name "scheme-gnunet")
@@ -46,10 +54,10 @@
                       #:select? (git-predicate %source-dir)))
    (build-system gnu-build-system)
    (propagated-inputs
-    (list guile-zlib guile-bytestructures guile-fibers-1.1 guile-gcrypt
+    (list guile-zlib guile-bytestructures guile-fibers-1.1/fixed guile-gcrypt
          guile-json-4 guile-pfds))
    (native-inputs
-    (list guile-3.0-latest guile-gcrypt guile-fibers-1.1 guile-json-4 
guile-pfds
+    (list guile-3.0-latest guile-gcrypt guile-fibers-1.1/fixed guile-json-4 
guile-pfds
          automake
          ;; Only used for testing.
          guile-quickcheck

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]