FIX: Msg 1203 and SQL Server May Be Shut Down with Large Cursor Row

ID: Q175887


The information in this article applies to:

BUG #: 17175 (NT: 6.5)

SYMPTOMS

SQL Server may recursively print Msg 1203 and be shut down after a stack overflow exception error. This problem can occur if all of the following conditions are true:

The following is the text of message 1203:

   Caller of lock manager is incorrectly trying to unlock an unlocked
   object. spid=10 locktype=6 dbid=6 lockid=645. 


CAUSE

The cursor code improperly handles the lock escalation and attempts to free page locks at the end of the fetch operation. This causes a recursive error 1203 leading to a stack overflow, at which time SQL Server stops.


WORKAROUND

To work around the problem, do either of the following:


STATUS

Microsoft has confirmed this to be a problem in SQL Server version 6.5. This problem was corrected in the latest Microsoft SQL Server 6.5 U.S. Service Pack. For information on obtaining the service pack, query on the following word in the Microsoft Knowledge Base (without the spaces):


   S E R V P A C K 


MORE INFORMATION

The following is the sequence of events that causes this problem to occur:

  1. Process A opens a keyset cursor on the table. After the cursor is opened, the user may perform cursor fetches.


  2. Process B performs a modification operation within a transaction, which causes it to hold an exclusive lock on a page.


  3. Process A performs a cursor fetch using a large rowset size. When it reaches the exclusively locked page, the process blocks, waiting on the lock to be released.


  4. Process B releases the exclusive page lock by either committing or rolling back the transaction.


  5. Process A continues scanning to retrieve the remainder of the cursor rowset and escalates to a table lock when the operation has scanned more pages than the configured "LE threshold maximum" value. When the full rowset has been filled, the process attempts to free previously obtained locks and encounters error 1203.




Because normal ANSI cursors, as exposed through Transact-SQL, only allow a cursor rowset size of 1, this problem will never occur if you use ANSI cursors. The client application may set a larger rowset size if it uses cursors from DB-Library, ODBC, or OLE-DB-based interfaces.

Additional query words: shutdown terminate terminated


Keywords          : kberrmsg SSrvAdmin SSrvLock SSrvProg kbbug6.50 kbfix6.50.sp4 
Version           : Windows:6.5
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: April 15, 1999