Microsoft KB Archive/181514

= FIX: Error 3307 with NOLOCK Joins in a Cursor Declaration =

Article ID: 181514

Article Last Modified on 3/14/2006

-

APPLIES TO


 * Microsoft SQL Server 6.5 Standard Edition

-



This article was previously published under Q181514



BUG #: 17798 (WINDOWS: 6.5)



SYMPTOMS
A cursor declaration containing a NOLOCK optimizer hint within the scope of a transaction, and running under stressful conditions on a multiprocessor computer may generate error 3307 when a rollback command is issued:

Error : 3307, Severity: 21, State: 1

Process 12 was expected to hold logical lock on page 416.

WARNING: Process being freed while holding Dataserver semaphore

The following is an example of an sp_cursoropen call: exec sp_cursoropen   @cursor=@ch output,

@stmt="select * from pubs.dbo.authors(NOLOCK),           pubs.dbo.sales(NOLOCK), pubs.dbo.titles(NOLOCK)", @scrollopt=1, @ccopt=4, @rows=@rc output



CAUSE
SQL Server suppressed duplicate key violations. When the user connection issued the rollback statement, some of the pages involved in the NOLOCK operation where still considered part of the transaction scope. The rollback attempt then encounters the error 3307 because it does not have a valid lock on the page.



WORKAROUND
To work around this problem, remove the NOLOCK optimizer hint.



STATUS
Microsoft has confirmed this to be a problem in SQL Server 6.5. This problem has been corrected in Service Pack 5a for Microsoft SQL Server 6.5.For more information, click the following article number to view the article in the Microsoft Knowledge Base:

197177 INF: How to Obtain SQL Server 6.5 Service Pack 5a

For more information, contact your primary support provider.



MORE INFORMATION
Other errors that have been encountered as part of the NOLOCK cursor usage are:


 * Error 605 and getpage errors, along with retries, appearing in the errorlog.
 * Spid -1 blocking other users.
 * Process -1 was expected to hold logical lock on page 416.
 * Error: 644, Severity: 21, State: 1

The non_clustered leaf row entry for page 384 row 0 was not found in

index page 400 indexid 2 database.
 * bufnew: page 0x178 (dbid 7) already hashed, stat 100c/0, objid(p/s/x)

0x82b3d84/0x1b3e11f8/0x1b3e11f8, indid=0x3, alloc=0x1/0,

bdnew/old=0xfa1640/0xfa1640, bnew/old=0xfa0c20/0xfa16a0,

pts/dbts=0x465d4c/0x465dc9, sdestat=0x800000
 * Kernel Process 10 has nonzero semaphore count = 2407.
 * Error: 814, Severity: 20, State: 1

Keep count of buffer 0xf029a0 holding logical page 610 in database

dbTest has become negative.
 * Unable to connect. The maximum number of '100' configured user

connections are already connected. System Administrator can configure to

a higher value with sp_configure.
 * Error: 1108, Severity: 21, State: 1

Cannot deallocate extent 464, database 2. Object id 0, index id 0,

status 0 in extent does not match object id -597577519, index id 1,

status 0 in object being deallocated. Run DBCC CHECKALLOC.
 * Error: 3904, Severity: 21, State: 1

Can't unsplit logical page 1477 in object 'tblA' in database 'dbTest' -

both pages together contain more data than will fit on one page.

Error while undoing log row in database 'dbTest'. Rid pageid is 0x2ec9 and row num is 0x20.
 * Error: 3414, Severity: 21, State: 1

Database 'dbTest' (dbid 7): Recovery failed. Please contact Technical

Support for further instructions.

Additional query words: db err log prodsql

Keywords: kbbug kbfix KB181514

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.