Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 328514

Summary: IRunAndRenderTask does not stop query when canceled
Product: z_Archived Reporter: Byron Palmer <byronpdx>
Component: BIRTAssignee: Mingxia Wu <mwu>
Status: VERIFIED FIXED QA Contact: Xiaoying Gu <bluesoldier>
Severity: normal    
Priority: P3 CC: bluesoldier, h.vonbargen, mwu
Version: 2.6.1   
Target Milestone: 3.7.0   
Hardware: PC   
OS: Windows XP   
Whiteboard: Obsolete
Attachments:
Description Flags
Test case for driver close of query none

Description Byron Palmer CLA 2010-10-22 17:08:32 EDT
Build Identifier: BIRT Runtime 2.6.1

The task created to build a report does not stop the query when canceled. When a user picks bad parameters the query may run for a long time. Canceling the task does not cancel the query. Even quitting the program does not cancel the query. This leaves these long running queries without any way except going to a database tool in order to cancel them. The task should be able to cancel the query.

Reproducible: Always

Steps to Reproduce:
1. Build a long running report
2. Start the report generation
3. call task.cancel() to stop the report
4. Go to the database and see that the query is still running.
Comment 1 Mingxia Wu CLA 2010-10-25 23:28:37 EDT
What's DBMS do you use? And could you please provide JDBC driver you're using? Could you have a check on whether this jdbc driver is supporting Statement.cancel() operator by writing test code?
Comment 2 Byron Palmer CLA 2010-10-27 15:37:03 EDT
Created attachment 181870 [details]
Test case for driver close of query

I have written a test case for the driver, which is MySQL 5.1.13. The output from this run is shown below.


Test connection
MySQLmysql-connector-java-5.1.13 ( Revision: ${bzr.revision-id} ) MySQL-AB JDBC Driver
Start query
Cancel trip true
In cancel ..1
Error in query Statement cancelled due to client request
Done with cancel

What this little test does is create a connection and gets its version.
Then it starts in another thread a query that takes some time.
It waits a few seconds and detects if the thread is still running, if so, then it cancels the query.
It then waits until the thread quits.

What one sees is that the query statement gets canceled and throws an error in the thread. The thread then closes and the test ends.

This shows that the driver is capable of cancelling a running query. It is my understanding from reading the old bug reports is that the cancel of a reporting task is only checked after the query returns a result set. What I need is to be able to cancel a query before that point in time. This means that the cancel needs to look at the process and cancel the query rather than wait for results to return.

This is my quess.
Comment 3 Henning von Bargen CLA 2011-01-14 08:58:44 EST
The same here with an Oracle JDBC driver.
Comment 4 Mingxia Wu CLA 2011-01-25 04:59:34 EST
Fix it now.
Comment 5 Xiaoying Gu CLA 2011-01-25 05:01:16 EST
Use SQLServer Profile to check the process status, when canceling the task, the query execution is canceled at once. Verified in the latest 2.6.2 build