-misc bugfixes

This commit is contained in:
Christian Grothoff 2021-09-05 23:09:34 +02:00
parent 303e47e24b
commit 87f5d8211e
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
5 changed files with 76 additions and 31 deletions

View File

@ -357,7 +357,6 @@ TALER_BANK_transfer (
return NULL; return NULL;
} }
json_decref (transfer_obj); json_decref (transfer_obj);
th->job = GNUNET_CURL_job_add2 (ctx, th->job = GNUNET_CURL_job_add2 (ctx,
eh, eh,
th->post_ctx.headers, th->post_ctx.headers,

View File

@ -988,6 +988,7 @@ make_transfer (
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
*ret_row_id = t->row_id; *ret_row_id = t->row_id;
*timestamp = t->date;
GNUNET_assert (0 == GNUNET_assert (0 ==
pthread_mutex_unlock (&h->uuid_map_lock)); pthread_mutex_unlock (&h->uuid_map_lock));
return GNUNET_OK; return GNUNET_OK;

View File

@ -54,28 +54,20 @@ MAX_DEBT_BANK = EUR:1000000000000000.0
[benchmark] [benchmark]
USER_PAYTO_URI = payto://x-taler-bank/localhost:8082/42 USER_PAYTO_URI = payto://x-taler-bank/localhost:8082/42
[exchange-account-2] [exchange-account-test]
# What is the payto://-URL of the exchange (to generate wire response) # What is the bank account (with the "Taler Bank" demo system)? Must end with "/".
PAYTO_URI = "payto://x-taler-bank/localhost:8082/Exchange" PAYTO_URI = "payto://x-taler-bank/localhost/Exchange"
# Authentication information for basic authentication
ENABLE_DEBIT = YES ENABLE_DEBIT = YES
ENABLE_CREDIT = YES ENABLE_CREDIT = YES
[exchange-accountcredentials-2] [exchange-accountcredentials-test]
# What is the bank account (with the "Taler Bank" demo system)? Must end with "/". WIRE_GATEWAY_URL = http://localhost:8082/Exchange/
WIRE_GATEWAY_URL = http://localhost:8082/taler-wire-gateway/Exchange/
# Authentication information for basic authentication
WIRE_GATEWAY_AUTH_METHOD = "basic" WIRE_GATEWAY_AUTH_METHOD = "basic"
USERNAME = Exchange USERNAME = Exchange
PASSWORD = x PASSWORD = x
[exchange-account-aggregator]
# What is the payto://-URL of the exchange (to generate wire response)
PAYTO_URI = "payto://aggregator-benchmark/exchangeacc"
ENABLE_DEBIT = YES
# Sections starting with "coin_" specify which denominations # Sections starting with "coin_" specify which denominations
# the exchange should support (and their respective fee structure) # the exchange should support (and their respective fee structure)
[coin_eur_ct_1] [coin_eur_ct_1]

View File

@ -370,7 +370,7 @@ work (void *cls)
rnd2 = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_NONCE, rnd2 = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_NONCE,
UINT64_MAX); UINT64_MAX);
GNUNET_asprintf (&acc, GNUNET_asprintf (&acc,
"payto://aggregator-benchmark/account-%llX-%llX", "payto://x-taler-bank/localhost:8082/account-%llX-%llX",
(unsigned long long) rnd1, (unsigned long long) rnd1,
(unsigned long long) rnd2); (unsigned long long) rnd2);
json_wire = GNUNET_JSON_PACK ( json_wire = GNUNET_JSON_PACK (
@ -548,7 +548,7 @@ run (void *cls,
sizeof (master_sig)); sizeof (master_sig));
if (0 > if (0 >
plugin->insert_wire_fee (plugin->cls, plugin->insert_wire_fee (plugin->cls,
"aggregator-benchmark", "x-taler-bank",
ws, ws,
we, we,
&wire_fee, &wire_fee,

View File

@ -33,6 +33,11 @@
*/ */
#define MAXIMUM_BATCH_SIZE 1024 #define MAXIMUM_BATCH_SIZE 1024
/**
* How often will we retry a request (given certain
* HTTP status codes) before giving up?
*/
#define MAX_RETRIES 16
/** /**
* Information about our work shard. * Information about our work shard.
@ -104,6 +109,17 @@ struct WirePrepareData
*/ */
unsigned long long row_id; unsigned long long row_id;
/**
* Number of bytes allocated after this struct
* with the prewire data.
*/
size_t buf_size;
/**
* How often did we retry so far?
*/
unsigned int retries;
}; };
@ -217,16 +233,6 @@ static void
shutdown_task (void *cls) shutdown_task (void *cls)
{ {
(void) cls; (void) cls;
if (NULL != ctx)
{
GNUNET_CURL_fini (ctx);
ctx = NULL;
}
if (NULL != rc)
{
GNUNET_CURL_gnunet_rc_destroy (rc);
rc = NULL;
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Running shutdown\n"); "Running shutdown\n");
if (NULL != task) if (NULL != task)
@ -241,6 +247,16 @@ shutdown_task (void *cls)
db_plugin = NULL; db_plugin = NULL;
TALER_EXCHANGEDB_unload_accounts (); TALER_EXCHANGEDB_unload_accounts ();
cfg = NULL; cfg = NULL;
if (NULL != ctx)
{
GNUNET_CURL_fini (ctx);
ctx = NULL;
}
if (NULL != rc)
{
GNUNET_CURL_gnunet_rc_destroy (rc);
rc = NULL;
}
} }
@ -410,6 +426,36 @@ wire_confirm_cb (void *cls,
wpd->row_id); wpd->row_id);
/* continued below */ /* continued below */
break; break;
case 0:
case MHD_HTTP_TOO_MANY_REQUESTS:
case MHD_HTTP_INTERNAL_SERVER_ERROR:
case MHD_HTTP_BAD_GATEWAY:
case MHD_HTTP_SERVICE_UNAVAILABLE:
case MHD_HTTP_GATEWAY_TIMEOUT:
wpd->retries++;
if (wpd->retries < MAX_RETRIES)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Wire transfer %llu failed (%u), trying again\n",
(unsigned long long) wpd->row_id,
http_status_code);
wpd->eh = TALER_BANK_transfer (ctx,
wpd->wa->auth,
&wpd[1],
wpd->buf_size,
&wire_confirm_cb,
wpd);
return;
}
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Wire transaction %llu failed: %u/%d\n",
(unsigned long long) wpd->row_id,
http_status_code,
ec);
db_plugin->rollback (db_plugin->cls);
global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown ();
return;
default: default:
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Wire transfer %llu failed: %u/%d\n", "Wire transfer %llu failed: %u/%d\n",
@ -469,7 +515,6 @@ wire_prepare_cb (void *cls,
const char *buf, const char *buf,
size_t buf_size) size_t buf_size)
{ {
const struct TALER_EXCHANGEDB_AccountInfo *wa;
struct WirePrepareData *wpd; struct WirePrepareData *wpd;
(void) cls; (void) cls;
@ -491,7 +536,12 @@ wire_prepare_cb (void *cls,
GNUNET_SCHEDULER_shutdown (); GNUNET_SCHEDULER_shutdown ();
return; return;
} }
wpd = GNUNET_new (struct WirePrepareData); wpd = GNUNET_malloc (sizeof (struct WirePrepareData)
+ buf_size);
memcpy (&wpd[1],
buf,
buf_size);
wpd->buf_size = buf_size;
wpd->row_id = rowid; wpd->row_id = rowid;
GNUNET_CONTAINER_DLL_insert (wpd_head, GNUNET_CONTAINER_DLL_insert (wpd_head,
wpd_tail, wpd_tail,
@ -510,9 +560,8 @@ wire_prepare_cb (void *cls,
GNUNET_SCHEDULER_shutdown (); GNUNET_SCHEDULER_shutdown ();
return; return;
} }
wa = wpd->wa;
wpd->eh = TALER_BANK_transfer (ctx, wpd->eh = TALER_BANK_transfer (ctx,
wa->auth, wpd->wa->auth,
buf, buf,
buf_size, buf_size,
&wire_confirm_cb, &wire_confirm_cb,
@ -580,6 +629,10 @@ run_transfers (void *cls)
NULL); NULL);
return; return;
} }
/* cap number of parallel connections to a reasonable
limit for concurrent requests to the bank */
limit = GNUNET_MIN (limit,
256);
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Checking for %lld pending wire transfers [%llu-...)\n", "Checking for %lld pending wire transfers [%llu-...)\n",
(long long) limit, (long long) limit,