View Issue Details

IDProjectCategoryView StatusLast Update
0008061Talermerchant backendpublic2024-03-07 19:47
ReporterChristian Grothoff Assigned ToChristian Grothoff Resolution deadline
ImplementerReviewer 
Release signed byDeployed by 
VerifierCommunicator 
Data protection authority notification requiredNo  
CSIRT notification requiredNo  
Estimated effort (hours)Actual effort (hours)0 
Fast-trackNo
Work packagenone
PriorityhighSeverityblockReproducibilityalways
Status closedResolutionfixed 
Platformi7OSDebian GNU/LinuxOS Versionsqueeze
Product Versiongit (master) 
Target Version0.9.4Fixed in Version0.9.4 
Summary0008061: taler-merchant-exchange fails to set 'wired' flags on the order
DescriptionOne bug was fixed in the SQL, still needs to be verified that it is working now.
TagsNo tags attached.

Required notifications

Address or linkRemarkAdded byNotifiedActions

The plan

IDSummaryStatusAssigned ToEstimated effort (hours)
0008168taler-unified-setup.sh fails to set IBAN for exchange closedAntoine A
This issue (hours)
Its children (hours)0
Together (hours)0
Nothing is missing: the plan can be finished.

Relationships

parent of 0008168 closedAntoine A taler-unified-setup.sh fails to set IBAN for exchange 
child of 0008153 closedChristian Grothoff test, package and upload merchant 0.9.4 to ftp and stable Debian/Ubuntu server 

Activities

Christian Grothoff

2024-01-25 22:56

manager   ~0021039

Confirmed _not_ working.

Christian Grothoff

2024-01-25 23:19

manager   ~0021042

For now, problem seems to be 1h future_retry timeout in taler-merchant-depositcheck which is triggered because when we look at _exactly_ the wire deadline, the exchange is not yet done, and so then we wait 1h. Probably should introduce some general slack before checking for wire transfers (1s?), and/or use some exponential back-off.

Christian Grothoff

2024-01-26 00:08

manager   ~0021043

Additional issue: depositcheck's pg_insert_deposit_to_transfer.sql first checks if the wire transfer actually is confirmed (SELECT ... FROM merchant_transfers CROSS JOIN...).
Two problems: here it is assumed that the exchange_pub is the *same* for both messages (doesn't have to be!), and if the merchant_transfer doesn't exist, we simply
do nothing (qs = 0). That might be fine (no wire transfer yet!), but we then do not update anything about the pending deposit status, so *immediately* retry the same deposit again, again querying the exchange, in a busy loop that just does DB-exchange-DB interactions and never terminates and never moves on to the next transaction. So very fatal.

The loop _might_ be broken if the wire transfer is actually added, that still needs to be tested.

Christian Grothoff

2024-01-26 00:10

manager   ~0021044

Trying to manually add the wire transfer failed (see screenshot, with error message in bad english).
bad-english.png (85,915 bytes)   
bad-english.png (85,915 bytes)   

Christian Grothoff

2024-01-26 00:11

manager   ~0021045

Oddly enough, repeating the same POST (trying to see the exact response), succeeded. Logs for the first transfer show:
2024-01-26T01:08:56.828203+0100 pq-1149038(6QE6W1FG1X5H77XT8MHBDK3BF0) INFO Query `insert_transfer'
failed with result: could not serialize access due to concurrent update/(null)/ERROR: could not ser
ialize access due to concurrent update
/PGRES_FATAL_ERROR/ERROR: could not serialize access due to concurrent update

2024-01-26T01:08:56.828907+0100 pq-1149038(6QE6W1FG1X5H77XT8MHBDK3BF0) ERROR Query `set_transfer_sta
tus_to_confirmed' failed with result: current transaction is aborted, commands ignored until end of
transaction block/(null)/ERROR: current transaction is aborted, commands ignored until end of trans
action block
/PGRES_FATAL_ERROR/ERROR: current transaction is aborted, commands ignored until end of transaction
 block

2024-01-26T01:08:56.828936+0100 taler-merchant-httpd-1149038(6QE6W1FG1X5H77XT8MHBDK3BF0) ERROR Assertion failed at taler-merchant-httpd_private-post-transfers.c:104.

Christian Grothoff

2024-01-26 00:15

manager   ~0021046

After that, the 'wire_pending' flag does go to 'false' in the merchant_deposit_confirmations table. However, the 'wired' bit in merchant_contract_terms remains on 'false'.
We probably lack the logic to set the contract_terms 'wired' flag when all deposit confirmations associated with a contract have gone to not wire_pending.

Christian Grothoff

2024-01-26 17:25

manager   ~0021051

Exponential retry-backoff implemented in 0b85857..52f2abe.

Christian Grothoff

2024-01-26 18:54

manager   ~0021052

Ok, I'm concluding that as-is, this is not directly implementable as the *schema* requires a certain sequence of events from the taler-merchant-(wirewatch, depositcheck, exchange) helpers which is not guaranteed to happen --- taler-merchant-(wirewatch, exchange, depositcheck) could happen just as easily, or taler-merchant-(depositcheck, wirewatch, exchange) and all but one of the 3 plausible orders will fail to clear the 'wired' flag and/or have other problems. The primary culprit is the 'credit_serial' FK in the deposit_to_transfer table. Replacing that with a non-FK wtid should allow any sequence to happen *and* to be implemented in a way to clear the 'wired' flag at the end.

Christian Grothoff

2024-01-26 21:40

manager   ~0021053

e3c4f55..159591d implements the schema changes. Still needs more testing to be confident about the fix.

Christian Grothoff

2024-01-28 14:04

manager   ~0021061

Shell script testing the various scenarios now exists, and passes. "real-world" test still pending.

Christian Grothoff

2024-01-28 23:02

manager   ~0021065

Finally finished. So many sub-problems, incredible. :-(

Issue History

Date ModifiedUsernameFieldChange
2024-01-10 15:57Christian GrothoffNew Issue
2024-01-10 15:57Christian GrothoffStatusnew => assigned
2024-01-10 15:57Christian GrothoffAssigned To => Christian Grothoff
2024-01-17 18:42Christian GrothoffCategoryexchange => mechant backend
2024-01-20 17:28Christian GrothoffRelationship addedrelated to 0008153
2024-01-20 17:28Christian GrothoffRelationship deletedrelated to 0008153
2024-01-20 17:28Christian GrothoffRelationship addedchild of 0008153
2024-01-21 15:56Christian GrothoffRelationship addedparent of 0008168
2024-01-25 22:56Christian GrothoffNote Added: 0021039
2024-01-25 23:19Christian GrothoffNote Added: 0021042
2024-01-26 00:08Christian GrothoffNote Added: 0021043
2024-01-26 00:10Christian GrothoffNote Added: 0021044
2024-01-26 00:10Christian GrothoffFile Added: bad-english.png
2024-01-26 00:11Christian GrothoffNote Added: 0021045
2024-01-26 00:15Christian GrothoffNote Added: 0021046
2024-01-26 00:15Christian GrothoffSeveritymajor => block
2024-01-26 17:25Christian GrothoffNote Added: 0021051
2024-01-26 18:54Christian GrothoffNote Added: 0021052
2024-01-26 21:40Christian GrothoffNote Added: 0021053
2024-01-28 14:04Christian GrothoffNote Added: 0021061
2024-01-28 23:02Christian GrothoffStatusassigned => informing
2024-01-28 23:02Christian GrothoffResolutionopen => fixed
2024-01-28 23:02Christian GrothoffFixed in Version => 0.9.4
2024-01-28 23:02Christian GrothoffNote Added: 0021065
2024-03-07 19:47Christian GrothoffStatusinforming => closed
2025-03-22 13:09Christian GrothoffCategorymechant backend => merchant backend