Re: Query was cancelled - reason?

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема Re: Query was cancelled - reason?
Дата
Msg-id 40E3F39A.8010405@opencloud.com
обсуждение исходный текст
Ответ на Query was cancelled - reason?  (Guido Fiala <guido.fiala@dka-gmbh.de>)
Ответы Re: Query was cancelled - reason?  (Guido Fiala <guido.fiala@dka-gmbh.de>)
Список pgsql-jdbc
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

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Markus Schaber
Дата:
Сообщение: Re: Performance Issues in 7.4.3
Следующее
От: "John Pagakis"
Дата:
Сообщение: Issue with now() within a transaction in pg74.213.jdbc.jar