View Issue Details

IDProjectCategoryView StatusLast Update
0005281Talermerchant backend API (C)public2021-09-02 18:14
ReporterFlorian Dold Assigned ToChristian Grothoff  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Versiongit (master) 
Target Version0.5Fixed in Version0.5 
Summary0005281: before handling a request, we should check if we are running in an un-commited transaction
DescriptionCurrently it is very hard to notice when we forgot to commit/abort a transaction. It can lead to weird results, like a constraint violation when we then "accidentally" abort previous inserts in a soft-failure retry.

Instead every request should first check if we are running inside a transaction, and if that's the case, commit it (or abort??) and log an error.
TagsNo tags attached.


Christian Grothoff

2018-03-04 01:02

manager   ~0012877

Well, I've checked, and the only way to _check_ whether we are in an uncommitted transaction seems to be to either try to COMMIT or ROLLBACK it. I am not sure which one is better...

Christian Grothoff

2018-03-12 11:47

manager   ~0012881

While the psql tool somehow can indicate on COMMIT that no transaction is pending, the libpq API doesn't seem to disclose that state to me (these transactions _always_ succeed, even without START). So I've added some explicit logic inside our code to track START/COMMIT/ROLLBACK events. This is not quite as certain to catch the un-COMMITed transactions as asking psql might be, but it is more efficient *and* should catch all but the most blatant violations of the overall design.

Christian Grothoff

2018-03-12 12:30

manager   ~0012882

Fixed now (last commit to merchant: 5f64092..9b56f3e).

Christian Grothoff

2021-09-02 18:14

manager   ~0018284

Fix committed to master branch.

Related Changesets

exchange: master a166ca7f

2018-03-12 12:33

Christian Grothoff

Details Diff
fix 0005281 for exchange: do preflight check that an old transaction is no longer running by accident Affected Issues
mod - src/auditor/taler-auditor.c Diff File
mod - src/auditor/taler-wire-auditor.c Diff File
mod - src/exchange/taler-exchange-aggregator.c Diff File
mod - src/exchange/taler-exchange-httpd_db.c Diff File
mod - src/exchange/taler-exchange-httpd_db.h Diff File
mod - src/exchange/taler-exchange-httpd_deposit.c Diff File
mod - src/exchange/taler-exchange-httpd_keystate.c Diff File
mod - src/exchange/taler-exchange-httpd_payback.c Diff File
mod - src/exchange/taler-exchange-httpd_refresh_link.c Diff File
mod - src/exchange/taler-exchange-httpd_refresh_melt.c Diff File
mod - src/exchange/taler-exchange-httpd_refresh_reveal.c Diff File
mod - src/exchange/taler-exchange-httpd_refund.c Diff File
mod - src/exchange/taler-exchange-httpd_reserve_status.c Diff File
mod - src/exchange/taler-exchange-httpd_reserve_withdraw.c Diff File
mod - src/exchange/taler-exchange-httpd_track_transaction.c Diff File
mod - src/exchange/taler-exchange-httpd_track_transfer.c Diff File
mod - src/exchange/taler-exchange-wirewatch.c Diff File
mod - src/exchange/test_taler_exchange_aggregator.c Diff File
mod - src/exchangedb/perf_taler_exchangedb_interpreter.c Diff File
mod - src/exchangedb/plugin_exchangedb_postgres.c Diff File
mod - src/exchangedb/test_exchangedb.c Diff File
mod - src/include/taler_exchangedb_plugin.h Diff File

Issue History

Date Modified Username Field Change
2018-02-20 13:10 Florian Dold New Issue
2018-02-20 13:10 Florian Dold Status new => assigned
2018-02-20 13:10 Florian Dold Assigned To => Christian Grothoff
2018-03-04 01:02 Christian Grothoff Note Added: 0012877
2018-03-12 11:47 Christian Grothoff Note Added: 0012881
2018-03-12 12:30 Christian Grothoff Note Added: 0012882
2018-03-12 12:30 Christian Grothoff Status assigned => resolved
2018-03-12 12:30 Christian Grothoff Resolution open => fixed
2018-03-12 12:30 Christian Grothoff Fixed in Version => 0.5
2018-03-12 12:30 Christian Grothoff Target Version 0.6 => 0.5
2018-04-15 20:33 Christian Grothoff Status resolved => closed
2021-09-02 18:13 Christian Grothoff Changeset attached => Taler-exchange master a166ca7f
2021-09-02 18:14 Christian Grothoff Note Added: 0018284