View Issue Details

IDProjectCategoryView StatusLast Update
0005281Talermerchant backend API (C)public2018-04-15 20:33
ReporterFlorian DoldAssigned 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).

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