Thread: Re: [GENERAL] ERROR: canceling query due to user request
On Sep 8, 2004, at 16:00, Tom Lane wrote: > This is a smoking gun: your client *is* issuing cancel requests, > whether > you know it or not. (Either that or some other process has magically > acquired the secret cancel key that was issued to your connection.) Thanks! I think I found the problem and a solution to it. The java framework reused Statement objects and issued a st.cancel() between every query performed with the Statement object. I just commented out the st.cancel() line and everything seems to work ok. I googled for others having the same problem and found this one: http://archives.postgresql.org/pgsql-jdbc/2003-09/msg00167.php Perhaps it is the same problem? Is this something that can be fixed in the jdbc driver or are PostgreSQL(+jdbc) doing the right thing here? Regards, - Tore.
On 09/09/2004 08:15 Tore Halset wrote: > On Sep 8, 2004, at 16:00, Tom Lane wrote: > >> This is a smoking gun: your client *is* issuing cancel requests, whether >> you know it or not. (Either that or some other process has magically >> acquired the secret cancel key that was issued to your connection.) > > Thanks! I think I found the problem and a solution to it. The java > framework reused Statement objects and issued a st.cancel() between every > query performed with the Statement object. I just commented out the > st.cancel() line and everything seems to work ok. I googled for others > having the same problem and found this one: > > http://archives.postgresql.org/pgsql-jdbc/2003-09/msg00167.php > > Perhaps it is the same problem? Is this something that can be fixed in > the jdbc driver or are PostgreSQL(+jdbc) doing the right thing here? > > Regards, > - Tore. Given that statement.cancel() should only be used to cancel a running query, I think the problem is more in your framework's misuse of cancel() rather than in the driver itself. -- Paul Thomas +------------------------------+-------------------------------------------+ | Thomas Micro Systems Limited | Software Solutions for Business | | Computer Consultants | http://www.thomas-micro-systems-ltd.co.uk | +------------------------------+-------------------------------------------+
Paul Thomas wrote: > Given that statement.cancel() should only be used to cancel a running > query, I think the problem is more in your framework's misuse of > cancel() rather than in the driver itself. JDBC gives you no way to ensure you only call cancel() on a running query (there's a race between query execution returning and the call to cancel()). Calling cancel() on a statement that's not currently executing should do nothing; if it ends up cancelling a future query, it's a driver bug. -O
On 09/09/2004 10:41 Oliver Jowett wrote: > Paul Thomas wrote: > >> Given that statement.cancel() should only be used to cancel a running >> query, I think the problem is more in your framework's misuse of >> cancel() rather than in the driver itself. > > JDBC gives you no way to ensure you only call cancel() on a running query > (there's a race between query execution returning and the call to > cancel()). Calling cancel() on a statement that's not currently executing > should do nothing; if it ends up cancelling a future query, it's a driver > bug. Thanks for the explaination Oliver. Maybe there is a driver bug then? -- Paul Thomas +------------------------------+-------------------------------------------+ | Thomas Micro Systems Limited | Software Solutions for Business | | Computer Consultants | http://www.thomas-micro-systems-ltd.co.uk | +------------------------------+-------------------------------------------+
Paul Thomas <paul@tmsl.demon.co.uk> writes: > On 09/09/2004 10:41 Oliver Jowett wrote: >> JDBC gives you no way to ensure you only call cancel() on a running query >> (there's a race between query execution returning and the call to >> cancel()). Calling cancel() on a statement that's not currently executing >> should do nothing; if it ends up cancelling a future query, it's a driver >> bug. > Thanks for the explaination Oliver. Maybe there is a driver bug then? IIRC there was such a bug at one time, but I thought it had been fixed. Maybe the problem is use of an old driver? regards, tom lane
Tom Lane wrote: > Paul Thomas <paul@tmsl.demon.co.uk> writes: > >>On 09/09/2004 10:41 Oliver Jowett wrote: >> >>>JDBC gives you no way to ensure you only call cancel() on a running query >>>(there's a race between query execution returning and the call to >>>cancel()). Calling cancel() on a statement that's not currently executing >>>should do nothing; if it ends up cancelling a future query, it's a driver >>>bug. > > >>Thanks for the explaination Oliver. Maybe there is a driver bug then? > > > IIRC there was such a bug at one time, but I thought it had been fixed. > Maybe the problem is use of an old driver? My patch for this never got applied, AFAIK. The current driver still seems to send the cancellation request and continue without waiting for an EOF from the server. -O
On Sep 9, 2004, at 18:02, Tom Lane wrote: > IIRC there was such a bug at one time, but I thought it had been fixed. > Maybe the problem is use of an old driver? I am using pgdev.305.jdbc3.jar. - Tore.