Subject RE: [firebird-support] Transaction Management Failing?
Author Paul Beach
> > The logic is that straightforward. The InsertMyData inserts lines of an invoice or any
> > other customer transaction into ledgers, each identified by a transaction number. The
> > problem is that when the issue occurs, multiple copies of the data end up in the database,
> > which based on the above logic should not be possible.
>
> Not quite so. You don't write down what exception happen in exception handler. If any
> exception happen between CommitTransaction and 'Done := true', you'll get duplicates.
> You haven't described how InsertMyData works. If (by mistake) it uses AutoCommit - the
> window where you logic can blow up is getting wider.
>
> > It’s a really difficult one as it is totally random.
>
> Still you can turn audit on and (even logs will be enormous) find out exact sequence of
> events.

Dimitry is right, I would suggest implementing the trace and audit facility, find out when the errror
next occurs and start looking at exactly what is happening as far as the database is concerned.

https://firebirdsql.org/rlsnotesh/rnfb25-trace.html

I tracked down a problem on a known accounting/inventory system using this feature, and proved there
was a logic problem within the client software.

Paul