Guido Fiala wrote:
> Hello,
>
> i'am currently run into a strange problem with fast subsequent updates in the same table.
>
> The application is quite complex, so its difficult to to sent a code snippet, i included the network traffic instead:
>
> This is whats happening:
[... COMMIT gets cancelled ...]
> So why comes the commit-error?
Three possibilities I can think of:
- Something is sending SIGINT to the backend process.
- You are calling JDBC's Statement.cancel() method (see below) which
ends up sending a SIGINT (indirectly via a backend process).
- You have statement_timeout set too low; queries appear to be cancelled
if they time out.
There is (AFAIK) still a race condition in the JDBC driver's
implementation of Statement.cancel() which means that it can
occasionally cancel a query "in the future" if called just before a
query begins execution, i.e. sometimes this sort of code will result in
a cancelled query:
stmt.cancel();
stmt.executeUpdate("..."); // Could be a different statement
// on the same connection too
In your case it sounds like it might be:
stmt.executeUpdate("...");
stmt.cancel(); // Perhaps done by a connection management layer
conn.commit(); // Actually executes a query behind the scenes
I looked at fixing cancel() some time ago but my changes didn't make it
into the driver in the end.
-O