FIX: Query Cancellation May Fail If No Delay After QueryID: Q185965
|
Under extremely narrow conditions, query cancellation can fail, causing a query to continue running on the server. During this interval the client will wait on the cancel API call. When the query completes, the server will acknowledge (ACK) the cancel to the client, which falls off the wait and continues.
You can avoid the problem by inserting an approximately 50-millisecond delay before the query cancellation.
Microsoft has confirmed this to be a problem in SQL Server
version 6.5. This problem has been corrected in U.S. Service Pack 5a
for Microsoft SQL Server version 6.5. For information about
downloading and installing the latest SQL Server Service Pack, see
http://support.microsoft.com/support/sql/.
For more information, contact your primary support provider.
From an API standpoint, query cancellation is done through the ODBC calls
SQLCancel() or SQLFreeStmt(), or the DB-Library call dbcancel().
From a user interface standpoint, query cancellation is done by certain
user actions that trigger one of the above APIs. For example, pressing
CTRL+C in the Isql.exe console screen while results are returning will
cause dbcancel() to occur.
The problem only occurs if queries are canceled immediately after sending.
For example if, after sending a query with SQLExecDirect(), the query is
immediately canceled with SQLCancel(), the problem may happen, but very
infrequently. It typically occurs with less than 0.1 percent frequency.
It is unlikely that the timing window can be reproduced by a human-driven
cancellation. Rather the application must do this programmatically using
the above APIs.
When discussing this area, the terms cancel and attention are often used
interchangeably. Also note that ACK is short for acknowledgment when used
in a network or client/server context.
The problem occurs frequently with multiple connections and symmetric
multiprocessing (SMP) hardware, however it can be seen under a single
connection, uniprocessor environment. The problem is very timing sensitive
and happens more frequently with local (unnamed) pipes than it does with a
local network named pipe.
Additional query words:
Keywords : kbbug6.50 kbfix6.50.SP5
Version : winnt:6.5
Platform : winnt
Issue type : kbbug
Last Reviewed: April 3, 1999