gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet-scheme] branch master updated: tests/util: Fix non-deterministic


From: gnunet
Subject: [gnunet-scheme] branch master updated: tests/util: Fix non-deterministic hang in 'garbage-collectable'.
Date: Wed, 27 Jul 2022 18:48:03 +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.

The following commit(s) were added to refs/heads/master by this push:
     new cc6d130  tests/util: Fix non-deterministic hang in 
'garbage-collectable'.
cc6d130 is described below

commit cc6d1306e96f18b3a7e2877e859f53a13b599013
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Wed Jul 27 18:46:06 2022 +0200

    tests/util: Fix non-deterministic hang in 'garbage-collectable'.
    
    A single (gc) is not sufficient, two are required due to apparent
    implementation details, see new comment for details.
    
    * tests/utils.scm (garbage-collectable)[test]<loop>: Run (gc) before
    returning #true.
---
 tests/utils.scm | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/tests/utils.scm b/tests/utils.scm
index 7428281..6abf87f 100644
--- a/tests/utils.scm
+++ b/tests/utils.scm
@@ -262,8 +262,16 @@ fiber exit and the fibers do not keep a reference to the 
service object."
            (sleep delay)
            (if (weak-vector-ref reference 0)
                ;; not yet collected, try again later.
-               (and (< delay 2.) (loop (* 2 delay)))
-               #true))))))) ; it was collected!
+               (and (< delay (gc-timeout)) (loop (* 2 delay)))
+               ;; A single (gc) is not sufficient -- the entry in the weak 
vector
+               ;; could become #false without it being added to the guardian,
+               ;; causing the fibers started by the service to not stop yet,
+               ;; causing hanging tests -- a second (gc) fixes that.
+               ;;
+               ;; Seem like an implementation detail, not worth reporting
+               ;; upstream.
+               (begin (gc)
+                      #true)))))))) ; it was collected!
   (define n-trials 32)
   (let loop ((successes 0)
             (trials 0))

-- 
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]