diff options
author | Christian Grothoff <christian@grothoff.org> | 2024-01-28 19:37:04 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2024-01-28 19:37:04 +0100 |
commit | f8f7c83cb8df30accb772ae1a4ea3fc62606a5cc (patch) | |
tree | 2a1c4e0f9d25299a21dc912faaf3c83663ed7908 | |
parent | 2b115add47166ad1dc9641ec2f3ed1730bf0fc7a (diff) |
fix #8030
-rw-r--r-- | debian/taler-exchange.taler-exchange-aggregator.service | 3 | ||||
-rw-r--r-- | debian/taler-exchange.taler-exchange-closer.service | 3 | ||||
-rw-r--r-- | debian/taler-exchange.taler-exchange-expire.service | 3 | ||||
-rw-r--r-- | debian/taler-exchange.taler-exchange-httpd.service | 3 | ||||
-rw-r--r-- | debian/taler-exchange.taler-exchange-transfer.service | 3 | ||||
-rw-r--r-- | debian/taler-exchange.taler-exchange-wirewatch.service | 3 | ||||
-rw-r--r-- | src/exchange/taler-exchange-aggregator.c | 3 | ||||
-rw-r--r-- | src/exchange/taler-exchange-closer.c | 10 | ||||
-rw-r--r-- | src/exchange/taler-exchange-expire.c | 4 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd.c | 19 | ||||
-rw-r--r-- | src/exchange/taler-exchange-transfer.c | 2 | ||||
-rw-r--r-- | src/exchange/taler-exchange-wirewatch.c | 2 | ||||
-rw-r--r-- | src/include/platform.h | 25 | ||||
-rwxr-xr-x | src/testing/taler-unified-setup.sh | 1 |
14 files changed, 61 insertions, 23 deletions
diff --git a/debian/taler-exchange.taler-exchange-aggregator.service b/debian/taler-exchange.taler-exchange-aggregator.service index 095945981..f92dfb178 100644 --- a/debian/taler-exchange.taler-exchange-aggregator.service +++ b/debian/taler-exchange.taler-exchange-aggregator.service @@ -7,8 +7,9 @@ After=postgres.service User=taler-exchange-aggregator Type=simple Restart=always +RestartMode=direct RestartSec=1s -RestartPreventExitStatus=9 +RestartPreventExitStatus=2 3 4 5 6 9 ExecStart=/usr/bin/taler-exchange-aggregator -c /etc/taler/taler.conf StandardOutput=journal StandardError=journal diff --git a/debian/taler-exchange.taler-exchange-closer.service b/debian/taler-exchange.taler-exchange-closer.service index ab9c6d98f..c6315375c 100644 --- a/debian/taler-exchange.taler-exchange-closer.service +++ b/debian/taler-exchange.taler-exchange-closer.service @@ -7,8 +7,9 @@ After=network.target postgres.service User=taler-exchange-closer Type=simple Restart=always +RestartMode=direct RestartSec=1s -RestartPreventExitStatus=9 +RestartPreventExitStatus=2 3 4 5 6 9 ExecStart=/usr/bin/taler-exchange-closer -c /etc/taler/taler.conf StandardOutput=journal StandardError=journal diff --git a/debian/taler-exchange.taler-exchange-expire.service b/debian/taler-exchange.taler-exchange-expire.service index a34cdccb7..7bbccc2aa 100644 --- a/debian/taler-exchange.taler-exchange-expire.service +++ b/debian/taler-exchange.taler-exchange-expire.service @@ -7,8 +7,9 @@ After=postgres.service User=taler-exchange-expire Type=simple Restart=always +RestartMode=direct RestartSec=1s -RestartPreventExitStatus=9 +RestartPreventExitStatus=2 3 4 5 6 9 ExecStart=/usr/bin/taler-exchange-expire -c /etc/taler/taler.conf StandardOutput=journal StandardError=journal diff --git a/debian/taler-exchange.taler-exchange-httpd.service b/debian/taler-exchange.taler-exchange-httpd.service index 2a4cf72e4..1fb538a15 100644 --- a/debian/taler-exchange.taler-exchange-httpd.service +++ b/debian/taler-exchange.taler-exchange-httpd.service @@ -12,8 +12,9 @@ Type=simple # Depending on the configuration, the service process kills itself and then # needs to be restarted. Thus no significant delay on restarts. Restart=always +RestartMode=direct RestartSec=1ms -RestartPreventExitStatus=9 +RestartPreventExitStatus=2 3 4 5 6 9 # Disable the service if more than 5 restarts are encountered within 5s. # These are usually the systemd defaults, but can be overwritten, thus we set diff --git a/debian/taler-exchange.taler-exchange-transfer.service b/debian/taler-exchange.taler-exchange-transfer.service index 40d47b09c..2557dbdf6 100644 --- a/debian/taler-exchange.taler-exchange-transfer.service +++ b/debian/taler-exchange.taler-exchange-transfer.service @@ -7,8 +7,9 @@ PartOf=taler-exchange.target User=taler-exchange-wire Type=simple Restart=always +RestartMode=direct RestartSec=1s -RestartPreventExitStatus=9 +RestartPreventExitStatus=2 3 4 5 6 9 ExecStart=/usr/bin/taler-exchange-transfer -c /etc/taler/taler.conf StandardOutput=journal StandardError=journal diff --git a/debian/taler-exchange.taler-exchange-wirewatch.service b/debian/taler-exchange.taler-exchange-wirewatch.service index 14023c12b..2a549977d 100644 --- a/debian/taler-exchange.taler-exchange-wirewatch.service +++ b/debian/taler-exchange.taler-exchange-wirewatch.service @@ -7,8 +7,9 @@ PartOf=taler-exchange.target User=taler-exchange-wire Type=simple Restart=always +RestartMode=direct RestartSec=1s -RestartPreventExitStatus=9 +RestartPreventExitStatus=2 3 4 5 6 9 RuntimeMaxSec=3600s ExecStart=/usr/bin/taler-exchange-wirewatch -c /etc/taler/taler.conf StandardOutput=journal diff --git a/src/exchange/taler-exchange-aggregator.c b/src/exchange/taler-exchange-aggregator.c index 7a579a9f5..1d0a0bb5d 100644 --- a/src/exchange/taler-exchange-aggregator.c +++ b/src/exchange/taler-exchange-aggregator.c @@ -382,6 +382,7 @@ release_shard (struct Shard *s) case GNUNET_DB_STATUS_SOFT_ERROR: GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR != qs); GNUNET_break (0); + global_ret = EXIT_FAILURE; GNUNET_SCHEDULER_shutdown (); return; case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: @@ -934,6 +935,7 @@ run_aggregation (void *cls) switch (ret) { case GNUNET_SYSERR: + global_ret = EXIT_FAILURE; GNUNET_SCHEDULER_shutdown (); db_plugin->rollback (db_plugin->cls); release_shard (s); @@ -1197,6 +1199,7 @@ drain_kyc_alerts (void *cls) { case GNUNET_SYSERR: GNUNET_break (0); + global_ret = EXIT_FAILURE; GNUNET_SCHEDULER_shutdown (); db_plugin->rollback (db_plugin->cls); /* just in case */ return; diff --git a/src/exchange/taler-exchange-closer.c b/src/exchange/taler-exchange-closer.c index 63a98bd0d..779525c4e 100644 --- a/src/exchange/taler-exchange-closer.c +++ b/src/exchange/taler-exchange-closer.c @@ -469,13 +469,11 @@ run_reserve_closures (void *cls) if (GNUNET_YES == test_mode) { GNUNET_SCHEDULER_shutdown (); + return; } - else - { - task = GNUNET_SCHEDULER_add_delayed (closer_idle_sleep_interval, - &run_reserve_closures, - NULL); - } + task = GNUNET_SCHEDULER_add_delayed (closer_idle_sleep_interval, + &run_reserve_closures, + NULL); return; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: (void) commit_or_warn (); diff --git a/src/exchange/taler-exchange-expire.c b/src/exchange/taler-exchange-expire.c index c7132fcb2..b2d34ee1c 100644 --- a/src/exchange/taler-exchange-expire.c +++ b/src/exchange/taler-exchange-expire.c @@ -272,9 +272,9 @@ run_expire (void *cls) "expire-purse")) { GNUNET_break (0); - global_ret = EXIT_FAILURE; db_plugin->rollback (db_plugin->cls); abort_shard (s); + global_ret = EXIT_FAILURE; GNUNET_SCHEDULER_shutdown (); return; } @@ -285,9 +285,9 @@ run_expire (void *cls) { case GNUNET_DB_STATUS_HARD_ERROR: GNUNET_break (0); - global_ret = EXIT_FAILURE; db_plugin->rollback (db_plugin->cls); abort_shard (s); + global_ret = EXIT_FAILURE; GNUNET_SCHEDULER_shutdown (); return; case GNUNET_DB_STATUS_SOFT_ERROR: diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c index 67e089627..e650b3fdd 100644 --- a/src/exchange/taler-exchange-httpd.c +++ b/src/exchange/taler-exchange-httpd.c @@ -2435,7 +2435,9 @@ run_single_request (void) xfork = fork (); if (-1 == xfork) { - global_ret = EXIT_FAILURE; + GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, + "fork"); + global_ret = EXIT_NO_RESTART; GNUNET_SCHEDULER_shutdown (); return; } @@ -2604,35 +2606,38 @@ run (void *cls, if (GNUNET_OK != TALER_TEMPLATING_init ("exchange")) { - global_ret = EXIT_FAILURE; + global_ret = EXIT_NOTINSTALLED; GNUNET_SCHEDULER_shutdown (); return; } if (GNUNET_SYSERR == TEH_plugin->preflight (TEH_plugin->cls)) { - global_ret = EXIT_FAILURE; + GNUNET_break (0); + global_ret = EXIT_NO_RESTART; GNUNET_SCHEDULER_shutdown (); return; } if (GNUNET_OK != TEH_extensions_init ()) { - global_ret = EXIT_FAILURE; + global_ret = EXIT_NOTINSTALLED; GNUNET_SCHEDULER_shutdown (); return; } if (GNUNET_OK != TEH_keys_init ()) { - global_ret = EXIT_FAILURE; + GNUNET_break (0); + global_ret = EXIT_NO_RESTART; GNUNET_SCHEDULER_shutdown (); return; } if (GNUNET_OK != TEH_wire_init ()) { - global_ret = EXIT_FAILURE; + GNUNET_break (0); + global_ret = EXIT_NO_RESTART; GNUNET_SCHEDULER_shutdown (); return; } @@ -2644,7 +2649,7 @@ run (void *cls, if (NULL == TEH_curl_ctx) { GNUNET_break (0); - global_ret = EXIT_FAILURE; + global_ret = EXIT_NO_RESTART; GNUNET_SCHEDULER_shutdown (); return; } diff --git a/src/exchange/taler-exchange-transfer.c b/src/exchange/taler-exchange-transfer.c index ae2b4fe7f..b0fad660c 100644 --- a/src/exchange/taler-exchange-transfer.c +++ b/src/exchange/taler-exchange-transfer.c @@ -574,7 +574,7 @@ wire_prepare_cb (void *cls, GNUNET_break (0); cleanup_wpd (); db_plugin->rollback (db_plugin->cls); - global_ret = EXIT_NOTCONFIGURED; + global_ret = EXIT_NO_RESTART; GNUNET_SCHEDULER_shutdown (); return; } diff --git a/src/exchange/taler-exchange-wirewatch.c b/src/exchange/taler-exchange-wirewatch.c index 34235eb94..da5d9c098 100644 --- a/src/exchange/taler-exchange-wirewatch.c +++ b/src/exchange/taler-exchange-wirewatch.c @@ -362,7 +362,6 @@ exchange_serve_process_config (void) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No accounts enabled for credit!\n"); GNUNET_SCHEDULER_shutdown (); - global_ret = EXIT_INVALIDARGUMENT; return GNUNET_SYSERR; } return GNUNET_OK; @@ -951,6 +950,7 @@ run (void *cls, { GNUNET_break (0); GNUNET_SCHEDULER_shutdown (); + global_ret = EXIT_NO_RESTART; return; } rc = GNUNET_CURL_gnunet_rc_create (ctx); diff --git a/src/include/platform.h b/src/include/platform.h index f27ee38b7..db04cb972 100644 --- a/src/include/platform.h +++ b/src/include/platform.h @@ -231,22 +231,42 @@ atoll (const char *nptr); /* LSB-style exit status codes */ #ifndef EXIT_INVALIDARGUMENT +/** + * Command-line arguments are invalid. + * Restarting useless. + */ #define EXIT_INVALIDARGUMENT 2 #endif #ifndef EXIT_NOTIMPLEMENTED +/** + * The requested operation is not implemented. + * Restarting useless. + */ #define EXIT_NOTIMPLEMENTED 3 #endif #ifndef EXIT_NOPERMISSION +/** + * Permissions needed to run are not available. + * Restarting useless. + */ #define EXIT_NOPERMISSION 4 #endif #ifndef EXIT_NOTINSTALLED +/** + * Key resources are not installed. + * Restarting useless. + */ #define EXIT_NOTINSTALLED 5 #endif #ifndef EXIT_NOTCONFIGURED +/** + * Key configuration settings are missing or invalid. + * Restarting useless. + */ #define EXIT_NOTCONFIGURED 6 #endif @@ -254,7 +274,12 @@ atoll (const char *nptr); #define EXIT_NOTRUNNING 7 #endif + #ifndef EXIT_NO_RESTART +/** + * Exit code from 'main' if we do not want to be restarted, + * except by manual intervention (hard failure). + */ #define EXIT_NO_RESTART 9 #endif diff --git a/src/testing/taler-unified-setup.sh b/src/testing/taler-unified-setup.sh index 5b379e189..e621567d9 100755 --- a/src/testing/taler-unified-setup.sh +++ b/src/testing/taler-unified-setup.sh @@ -581,6 +581,7 @@ then $USE_VALGRIND taler-merchant-wirewatch \ -c "$CONF" \ -L "$LOGLEVEL" \ + --persist \ 2> taler-merchant-wirewatch.log & echo " DONE" fi |