Thread: What is causing 'canceling statement due to user request' ?

What is causing 'canceling statement due to user request' ?

From
Csaba Nagy
Date:
Hi all,

I know of 2 causes:

 - hit CTRL-C in the psql client;
 - have a non-zero statement timeout and have the statement actually
time out;

But I am seeing this via JDBC which can't cancel a statement AFAIK, and
the statement_timeout is set to 0 (in the config file globally, and
there's no override for the users, nor in our JDBC code).

I wonder if there is any other scenario which can trigger this error ? I
found a lot of them in our logs, last night we had hundreds of them, but
now that I looked it happened sporadically in the past too...

Could some network problem trigger this ?

TIA,
Csaba.



Re: What is causing 'canceling statement due to user request' ?

From
Tom Lane
Date:
Csaba Nagy <nagy@ecircle-ag.com> writes:
> I wonder if there is any other scenario which can trigger this error ?

Anything sending SIGINT to a backend process would result in this
behavior.  We've heard rumors that there are platforms wherein SIGINT
is used for strange purposes like enforcing process-runtime limits.

            regards, tom lane

Re: What is causing 'canceling statement due to user request' ?

From
Thomas Kellerer
Date:
On 23.10.2006 16:14 Csaba Nagy wrote:
> Hi all,
>
> I know of 2 causes:
>
>  - hit CTRL-C in the psql client;
>  - have a non-zero statement timeout and have the statement actually
> time out;
>
> But I am seeing this via JDBC which can't cancel a statement AFAIK

JDBC *can* cancel a running statement. You just need to call cancel()
from another thread.

http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Statement.html#cancel()

Works great in my SQL front end.

Thomas

Re: What is causing 'canceling statement due to user

From
Csaba Nagy
Date:
> JDBC *can* cancel a running statement. You just need to call cancel()
> from another thread.
>
> http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Statement.html#cancel()
>
> Works great in my SQL front end.

Are you sure ? Ever tried to cancel a long running statement and see if
it is still running in the DB after you cancelled it on the JDBC side ?

Cheers,
Csaba.



Re: What is causing 'canceling statement due to user

From
Thomas Kellerer
Date:
On 27.10.2006 10:13 Csaba Nagy wrote:
>> JDBC *can* cancel a running statement. You just need to call cancel()
>> from another thread.
>>
>> http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Statement.html#cancel()
>>
>> Works great in my SQL front end.
>
> Are you sure ? Ever tried to cancel a long running statement and see if
> it is still running in the DB after you cancelled it on the JDBC side ?
Hmm. Pretty sure, I did not really check the server itself, but I could
see that the CPU load (running a local Postgres) went down immediately,
which I took that the statement was no longer processed by the server.

Thomas