From: Oliver Jowett <oliver@opencloud.com>
To: Guido Fiala <guido.fiala@dka-gmbh.de>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Query was cancelled - reason?
Date: Thu, 01 Jul 2004 23:20:58 +1200
Message-ID: <40E3F39A.8010405@opencloud.com> (raw)
In-Reply-To: <200407011053.00170.guido.fiala@dka-gmbh.de>
References: <200407011053.00170.guido.fiala@dka-gmbh.de>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: oliver@opencloud.com, guido.fiala@dka-gmbh.de
Subject: Re: Query was cancelled - reason?
In-Reply-To: <40E3F39A.8010405@opencloud.com>
References: <200407011053.00170.guido.fiala@dka-gmbh.de> <40E3F39A.8010405@opencloud.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox