gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated (a677f67 -> ccd79e6)


From: gnunet
Subject: [taler-anastasis] branch master updated (a677f67 -> ccd79e6)
Date: Sun, 26 Jun 2022 16:10:52 +0200

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

grothoff pushed a change to branch master
in repository anastasis.

    from a677f67  -fix dependency versions
     new beb45b1  -add test case for #7227
     new ccd79e6  fix #7227: use short timeout

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/cli/Makefile.am                                |  1 +
 ... => test_anastasis_reducer_recovery_hanging.sh} | 31 +++++++++++++++++++---
 src/reducer/anastasis_api_redux.c                  | 20 ++++++++++----
 3 files changed, 44 insertions(+), 8 deletions(-)
 copy src/cli/{test_anastasis_reducer_recovery_no_pay.sh => 
test_anastasis_reducer_recovery_hanging.sh} (94%)

diff --git a/src/cli/Makefile.am b/src/cli/Makefile.am
index dccd9af..44cad27 100644
--- a/src/cli/Makefile.am
+++ b/src/cli/Makefile.am
@@ -21,6 +21,7 @@ check_SCRIPTS = \
   test_anastasis_reducer_enter_secret.sh \
   test_anastasis_reducer_recovery_enter_user_attributes.sh \
   test_anastasis_reducer_recovery_no_pay.sh \
+  test_anastasis_reducer_recovery_hanging.sh \
   test_iban.sh
 
 
diff --git a/src/cli/test_anastasis_reducer_recovery_no_pay.sh 
b/src/cli/test_anastasis_reducer_recovery_hanging.sh
similarity index 94%
copy from src/cli/test_anastasis_reducer_recovery_no_pay.sh
copy to src/cli/test_anastasis_reducer_recovery_hanging.sh
index 12ac7e9..f67b850 100755
--- a/src/cli/test_anastasis_reducer_recovery_no_pay.sh
+++ b/src/cli/test_anastasis_reducer_recovery_hanging.sh
@@ -1,8 +1,9 @@
 #!/bin/bash
 # This file is in the public domain.
+# Runs tests with a 'hanging' Anastasis provider.
 
 set -eu
-set -x
+#set -x
 
 # Exit, with status code "skip" (no 'real' failure)
 function exit_skip() {
@@ -21,6 +22,7 @@ function cleanup()
 {
     for n in `jobs -p`
     do
+        kill -SIGCONT $n # in case suspended...
         kill $n 2> /dev/null || true
     done
     rm -rf $CONF $R1FILE $R2FILE $B1FILE $B2FILE $TMP_DIR
@@ -87,6 +89,9 @@ trap cleanup EXIT
 echo -n "Testing for jq"
 jq -h > /dev/null || exit_skip "jq required"
 echo " FOUND"
+echo -n "Testing for timeout"
+timeout --help > /dev/null || exit_skip "timeout required"
+echo " FOUND"
 echo -n "Testing for anastasis-reducer ..."
 anastasis-reducer -h > /dev/null || exit_skip "anastasis-reducer required"
 echo " FOUND"
@@ -122,9 +127,17 @@ echo " OK"
 echo -n "Launching anastasis services ..."
 PREFIX="" #valgrind
 $PREFIX anastasis-httpd -c $CONF_1 2> anastasis-httpd_1.log &
+PPID_1=$!
 $PREFIX anastasis-httpd -c $CONF_2 2> anastasis-httpd_2.log &
+PPID_2=$!
 $PREFIX anastasis-httpd -c $CONF_3 2> anastasis-httpd_3.log &
+PPID_3=$!
 $PREFIX anastasis-httpd -c $CONF_4 2> anastasis-httpd_4.log &
+PPID_4=$!
+export PPID_1
+export PPID_2
+export PPID_3
+export PPID_4
 
 echo -n "Waiting for anastasis services ..."
 
@@ -163,12 +176,24 @@ anastasis-reducer -a \
   '{"country_code": "xx"}' \
   select_country < $B2FILE > $B1FILE
 echo -n "."
-anastasis-reducer -a \
+
+kill -SIGSTOP $PPID_4
+START=`date '+%s'`
+timeout 10 anastasis-reducer -L DEBUG -a \
   '{"identity_attributes": {
     "full_name": "Max Musterman",
     "sq_number": "4",
     "birthdate": "2000-01-01"}}' \
-  enter_user_attributes < $B1FILE > $B2FILE
+        enter_user_attributes < $B1FILE > $B2FILE || true
+END=`date '+%s'`
+DELTA=`expr $END - $START`
+kill -SIGCONT $PPID_4
+
+if test $DELTA -ge 5
+then
+    exit_fail "Reducer hangs on suspended provider in 'enter_user_attributes'"
+fi
+
 cat $B2FILE > $B1FILE
 echo -n ","
 sync_providers $B1FILE $B2FILE
diff --git a/src/reducer/anastasis_api_redux.c 
b/src/reducer/anastasis_api_redux.c
index 1c770f1..8090e00 100644
--- a/src/reducer/anastasis_api_redux.c
+++ b/src/reducer/anastasis_api_redux.c
@@ -1,6 +1,6 @@
 /*
   This file is part of Anastasis
-  Copyright (C) 2020, 2021 Anastasis SARL
+  Copyright (C) 2020, 2021, 2022 Anastasis SARL
 
   Anastasis is free software; you can redistribute it and/or modify it under 
the
   terms of the GNU General Public License as published by the Free Software
@@ -36,6 +36,12 @@
  */
 #define CONFIG_GENERIC_TIMEOUT GNUNET_TIME_UNIT_MINUTES
 
+/**
+ * How long do we wait in a more "synchronous"
+ * scenaro for a /config reply from an Anastasis provider.
+ */
+#define CONFIG_FAST_TIMEOUT GNUNET_TIME_UNIT_SECONDS
+
 
 #define GENERATE_STRING(STRING) #STRING,
 static const char *generic_strings[] = {
@@ -651,11 +657,13 @@ config_request_timeout (void *cls)
 /**
  * Schedule job to obtain Anastasis provider configuration at @a url.
  *
+ * @param timeout how long to wait for a reply
  * @param url base URL of Anastasis provider
  * @return check config handle
  */
 static struct ConfigRequest *
-check_config (const char *url)
+check_config (struct GNUNET_TIME_Relative timeout,
+              const char *url)
 {
   struct ConfigRequest *cr;
 
@@ -687,7 +695,7 @@ check_config (const char *url)
     GNUNET_break (0);
     return NULL;
   }
-  cr->tt = GNUNET_SCHEDULER_add_delayed (CONFIG_GENERIC_TIMEOUT,
+  cr->tt = GNUNET_SCHEDULER_add_delayed (timeout,
                                          &config_request_timeout,
                                          cr);
   return cr;
@@ -795,7 +803,8 @@ begin_provider_config_check (const char *cc,
                      json_object_set_new (pl,
                                           url,
                                           prov));
-      check_config (url);
+      check_config (CONFIG_GENERIC_TIMEOUT,
+                    url);
     }
     GNUNET_assert (0 ==
                    json_object_set_new (state,
@@ -1159,7 +1168,8 @@ ANASTASIS_REDUX_add_provider_to_state_ (const char *url,
   struct ConfigRequest *cr;
   struct ConfigReduxWaiting *w;
 
-  cr = check_config (url);
+  cr = check_config (CONFIG_FAST_TIMEOUT,
+                     url);
   w = GNUNET_new (struct ConfigReduxWaiting);
   w->cr = cr;
   w->state = json_incref (state);

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