An assertion or Msg 7987 may occur when an operation is performed on an instance of SQL Server (828337)



The information in this article applies to:

  • Microsoft SQL Server 2000 (all editions)

Bug #: 470270 (SQL Server 8.0)
Bug #: 470213 (SQL Server 8.0)
Bug #: 469600 (SQL Server 8.0)
Bug #: 676059 (SQL Server 9.0)



SYMPTOMS

When you run an operation, such as a SELECT Transact-SQL statement or an UPDATE Transact-SQL statement, on an instance of Microsoft SQL Server 2000, you may receive an assertion error message that is similar to one of the following:
Msg 3624
Location: p:\sql\ntdbms\storeng\drs\include\record.inl:SQLServerVersion
Expression: m_SizeRec > 0 && m_SizeRec <= MAXDATAROW SPID: ProcessID
Process ID: SQLServerEXEProcessID
Msg 3624
Location: recbase.cpp:SQLServerVersion
Expression: m_offBeginVar < m_SizeRec SPID: ProcessID
Process ID: SQLServerEXEProcessID
Msg 3624
Location: recbase.cpp:SQLServerVersion
Expression: m_nVars > 0 SPID: ProcessID
Process ID: SQLServerEXEProcessID
Note In the error messages, SQLServerVersion is the version of the instance of SQL Server where the error occurred. This information is only important for Microsoft Product Support Services (PSS) to analyze. In the error messages, ProcessID is the SQL Server Process Identification (SPID) number where the problem occurred. In the error messages, SQLServerEXEProcessID is the process identification number of the Sqlservr.exe process where the problem occurred.

When these assertion errors occur, SQL Server records information in the error log file. This problem may occur when SQL Server tries to read data from a data page.

Starting with SQL 2000 Service Pack 4, these assertions will no longer be produced by the SQL Server engine. When these failure conditions occur, SQL Server will now return the following error to the application:
Error: 7987, Severity: 22, State: 1 A possible database consistency problem has been detected on database '<dbname>'. DBCC CHECKDB and DBCC CHECKCATALOG should be run on database '<dbname>'.
A stack dump will be written to the ERRORLOG that is similar to the previous behavior with assertion. However, at the end of this dump, Msg 7987 will be written into the ERRORLOG.

CAUSE

The problem may occur if inconsistencies exist in the databases on the instance of SQL Server.

RESOLUTION

To resolve this problem, determine the database where the inconsistencies exist, and then resolve the inconsistencies. To do this, follow these steps:
  1. On the instance of SQL Server where the failure occurred, run the DBCC CHECKDB Transact-SQL command on all the databases.
  2. If the DBCC CHECKDB Transact-SQL command reports errors that indicate database inconsistencies, resolve the errors.
For more information about the DBCC CHECKDB Transact-SQL command, visit the following Microsoft Web site: If the DBCC CHECKDB Transact-SQL command does not report an error for the databases on the instance of SQL Server, or if the problem occurs after you perform the appropriate tasks to resolve the errors that were reported, contact PSS to investigate and to troubleshoot the problem. To investigate this problem, PSS must have all the error log files and minidump files that are associated with the assertion failure. For information about how to obtain the minidump file that is associated with the assertion failure, see the "More Information" section. For a complete list of PSS phone numbers and information about support costs, visit the following Microsoft Web site:

MORE INFORMATION

SQL Server performs certain runtime checks that can help indicate a problem that may require corrective action. These checks are known as assertions. When an assertion check fails, SQL Server performs the following actions:
  1. SQL Server considers the assertion a fatal error.
  2. SQL Server returns information about the assertion to the application in a 3624 error message.
  3. As part of producing the stack dump file, SQL Server follows these steps:
    1. SQL Server writes the details about the stack dump file and the details of the assertion to the SQL Server error log file.
    2. SQL Server creates a minidump file.
    3. If SQL Server is configured to use error reporting, SQL Server sends the files to the Watson Error Reporting Web site.
  4. SQL Server ends the connection to the client application.
The SQL Server error log files and the minidump file can be used by PSS to identify and to analyze the problem. For example, if you experience the problem that is mentioned in the "Symptoms" section, the following information may be included in the SQL Server error log file:
2003-09-11 13:50:14.49 spid62    Using 'dbghelp.dll' version '4.0.5'
*Dump thread - spid = 62, PSS = 0x4b2e31f0, EC = 0x4b2e3518
*Stack Dump being sent to C:\Program Files\Microsoft SQL Server\MSSQL$SQL2K_TWO\log\SQLDump0261.txt
You may also see a stack dump file that is similar to the following in the SQL Server error log file:
* Short Stack Dump
* 00871255 Module(sqlservr+00471255) (CStackDump::GetContextAndDump+0000002E)
* 00872C81 Module(sqlservr+00472C81) (stackTrace+0000021D)
* 009286FA Module(sqlservr+005286FA) (utassert_fail+000002E3)
* 007F12E8 Module(sqlservr+003F12E8) (RecBase::ReSizeVar+00000069)
* 00404DD9 Module(sqlservr+00004DD9) (RecBase::Resize+0000005B)
* 00429024 Module(sqlservr+00029024) (RowsetSS::GetColumns+000000B6)
* 0042AE29 Module(sqlservr+0002AE29) (RowsetSS::GetData+00000071)
* 00528CFF Module(sqlservr+00128CFF) (CValSSTable::GetDataWithBuffer+00000031)
* 00528CD3 Module(sqlservr+00128CD3) (GetDataWithBuffer+00000028)
* 00419B19 Module(sqlservr+00019B19) (CEs::GeneralEval4+00000075)
* 0042C37D Module(sqlservr+0002C37D) (CQScanHashMatch::Iterate+000015B4)
* 0042D80E Module(sqlservr+0002D80E) (CQScanHashMatch::Open+00000065)
* 0043D029 Module(sqlservr+0003D029) (CQScanNLJoin::Open+00000014)
* 0042970E Module(sqlservr+0002970E) (CQScan::Open+0000001C)
* 004297EB Module(sqlservr+000297EB) (CQScanStreamAggregate::Open+0000000E)
* 0041DB69 Module(sqlservr+0001DB69) (CQueryScan::Startup+0000010D)
* 0041955F Module(sqlservr+0001955F) (CStmtQuery::ErsqExecuteQuery+0000026B)
* 00428562 Module(sqlservr+00028562) (CStmtSelect::XretExecute+00000229)
* 00410855 Module(sqlservr+00010855) (CMsqlExecContext::ExecuteStmts+000003DD)
* 0040FEB4 Module(sqlservr+0000FEB4) (CMsqlExecContext::Execute+000001B6)
* 0041164F Module(sqlservr+0001164F) (CSQLSource::Execute+00000331)
* 004BA63E Module(sqlservr+000BA63E) (CStmtExec::XretLocalExec+0000014D Line 4058+0000002F)
* 004BA4DA Module(sqlservr+000BA4DA) (CStmtExec::XretExecute+0000031A Line 3990+00000017)
* 00410855 Module(sqlservr+00010855) (CMsqlExecContext::ExecuteStmts+000003DD)
* 0040FEB4 Module(sqlservr+0000FEB4) (CMsqlExecContext::Execute+000001B6)
* 0041164F Module(sqlservr+0001164F) (CSQLSource::Execute+00000331)
* 0053EC96 Module(sqlservr+0013EC96) (language_exec+000003E1)
* 0041226E Module(sqlservr+0001226E) (process_commands+000000EC)
* 41073379 Module(UMS+00003379) (ProcessWorkRequests+0000024A)
* 41073071 Module(UMS+00003071) (ThreadStartRoutine+000000BD)
* 7800C9EB Module(MSVCRT+0000C9EB) (exception::exception+0000000E)
* 77E8B2D8 Module(KERNEL32+0000B2D8) (lstrcmpiW+000000B7)
* -------------------------------------------------------------------------------
2003-09-11 13:57:11.46 spid61    Stack Signature for the dump is 0x1734F5E3
2003-08-19 10:56:52.97 spid62    SQL Server Assertion: File: <recbase.cpp>, line=1378
Failed Assertion = 'm_offBeginVar < m_SizeRec'.
Error: 3624, Severity: 20, State: 1.
Note The information in the SQL Server error log file may vary depending on the type of assertion check failure that occurred and the type of query or operation that caused the problem.

The assertion failures that are mentioned in the "Symptoms" section are runtime checks that typically indicate a database consistency problem that may exist with a data row or an index row in a database table on the instance of SQL Server. Therefore, you must perform the steps that are mentioned in the "Resolution" section to resolve the problem. If this assertion failure occurs on an instance of SQL Server 2000 Service Pack 3 (SP3) or later, a Watson Error Report is generated, and the stack dump information is written in a minidump (.mdmp) file.

Note By default, the SQL Server error log file and the minidump file are written to the Installation drive:\Program Files\Microsoft SQL Server\MSSQL\LOG folder. The minidump file has the same name as the text file (.txt) where the stack dump file is stored. For example, if the name of the text file where the stack dump file is stored is SQLDump0261.txt, the name of the minidump file is SQLDump0261.mdmp.

REFERENCES

For additional information, click the following article numbers to view the articles in the Microsoft Knowledge Base:

317852 FIX: An INSERT may fail with a 3624 error message after a failed attempt to add new table column

827714 FIX: A query may fail with retail assertion when you use the NOLOCK hint or the READ UNCOMMITTED isolation level


Modification Type:MajorLast Reviewed:4/19/2005
Keywords:kbtshoot kbTSQL kbMsg kbDatabase kbQuery kberrmsg kbprb KB828337 kbAudDeveloper