SQL Server Q&A

As a software engineer, I focus on .NET, especially asp.net, C#, WCF and so on, and I am also very interested in Search Engine Optimization.

Entries Tagged ‘access violation’

FIX: Query Using Nested IN and a CASE Clause Causes an Access Violation

Symptoms
Running a query with two or more nested IN clauses and a CASE statement may cause the connection to be broken and the following error to be returned:

ODBC: Msg 0, Level 19, State 1
SqlDumpExceptionHandler: Process 7 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.Connection Broken
Resolution
The query caused a handled exception in SQL Server, and the process was stopped.

FIX: Parallel Query That Has Many Bit Columns May Cause Access Violation

Symptoms
If a query that returns many bit columns is run as a parallel query and the row size passed through one of the Parallelism physical operators in the plan exceeds approximately 8 KB in size, a handled access violation may occur.
Resolution
A Parallelism physical operator is limited to handling a row size greater than approximately 8 KB in size, and normally such plans are excluded from being run as a parallel plan. Due to a bug in the calculation of the row size when handling bit columns, the query is incorrectly allowed to run in parallel but overflows a buffer allocated for transferring the data between threads.

FIX: Merge Agent Fails with a “The remote procedure call failed and did not execute” Error

Symptoms
The merge agent fails with the following error message:

The remote procedure call failed and did not executeThe task reports the preceding remote procedure call (RPC) failure in its history, which can be misleading because there are not any other connectivity problems. The merge agent runs into a handled exception with the following stack, as seen in the replication exception log file:

The Exception Stack Dump follows:
ntdll77f67546RtlpWaitForCriticalSection
ntdll41d70871RtlEnterCriticalSection
replrec41d68839CReconcilerHistory::AddMessage
replrec41d666c8CDatabaseReconciler::LogProgressMessage
replrec41d66362CDatabaseReconciler::ProcTombstones
replrec41d65449CDatabaseReconciler::MoveChangesToDest
replrec00403819CDatabaseReconciler::Reconcile
replmerg004038e2CReconcilerTask::Reconcile
replmerg00407af8AgentRun
replmerg08ec83ecAgentMain

Resolution
The RPC failed message is the result of a exception with the merge agent. Replmerg.exe fails while inserting generation history, generating an exception when completely filling the allocated memory buffer. This causes an out of space situation and the required null termination character cannot be added, subsequently causing the access violation.

FIX: Improved SQL Manager Robustness for Odd Length Buffer

Symptoms
An access violation (AV) exception may occur when SQL Server tries to free the relevant memory block. The following is a sample short stack dump that you may see in the error log:

* Short Stack Dump* 0040A829 Module(sqlservr+0000A829) (CVariableInfo::CVarBlock::PvbJoin+00000035)* 0040A782 Module(sqlservr+0000A782) (CVariableInfo::PviRelease+00000056)* 0040A72C Module(sqlservr+0000A72C) (CVarPageMgr::Release+00000014)* 00401B52 Module(sqlservr+00001B52) (CMemObj::Free+0000001E)* 00401AFD Module(sqlservr+00001AFD) (CMemThread::Free+00000044)* 00401B26 Module(sqlservr+00001B26) (commondelete+0000001B)* 00560988 Module(sqlservr+00160988) (CSql::~CSql+00000021)* 0053E4B9 Module(sqlservr+0013E4B9) (CSqlMgr::DerefSql+00000065)* 0053EAC8 Module(sqlservr+0013EAC8) (CCompPlan::~CCompPlan+00000051)* 0053EA4B Module(sqlservr+0013EA4B) (CCompPlan::`vector deleting destructor’+0000000B)* 00440B4F Module(sqlservr+00040B4F) (CCacheObject::Release+000000D8)* 005D2F4F Module(sqlservr+001D2F4F) (CCache::FRemoveOne+00000316)* 0081AB31 Module(sqlservr+0041AB31) (BPool::ReplenishFreeList+00000144)* 0040AFAB Module(sqlservr+0000AFAB) (BPool::HelpLazyWriter+00000037)* 004306F5 Module(sqlservr+000306F5) (BPool::ReadAhead+00000074)* 00431A6D Module(sqlservr+00031A6D) (SDES::ReadAhead+0000006D)* 00521D63 Module(sqlservr+00121D63) (UnorderedPageSupplier::AddToQueue+00000546)* 00521938 Module(sqlservr+00121938) (UnorderedPageSupplier::GetNextPage+0000006C)* 00405810 Module(sqlservr+00005810) (SDES::GetBiDi+0000019C)* 0043362A Module(sqlservr+0003362A) (RowsetSS::FetchNextRow+000000B0)* 00433506 Module(sqlservr+00033506) (CQScanRowset::GetRowWithPrefetch+00000040)* 00521769 Module(sqlservr+00121769) (CQScanTableScan::GetRow+0000005F)* 0042C876 Module(sqlservr+0002C876) (CRowPrefetchDelayMgr::PopulateBuffer+0000001F)* 0042C334 Module(sqlservr+0002C334) (CRowPrefetchDelayMgr::GetRowUnordered+0000001E)* 0042C247 Module(sqlservr+0002C247) (CRowPrefetchDelayMgr::GetRow+0000001B)* 0042C22B Module(sqlservr+0002C22B) (CQScanRangePrefetchDelay::GetRow+00000014)* 0042D02F Module(sqlservr+0002D02F) (CQScanNLJoin::GetRow+0000010B)* 006D58CB Module(sqlservr+002D58CB) (CQScanConcat::GetRow+0000001C)* 005285B0 Module(sqlservr+001285B0) (CQScanSort::BuildSortTable+00000047)* 00528560 Module(sqlservr+00128560) (CQScanSort::Open+00000032)* 0041D92F Module(sqlservr+0001D92F) (CQueryScan::Startup+0000010D)* 0041925F Module(sqlservr+0001925F) (CStmtQuery::ErsqExecuteQuery+0000026B)* 00432F55 Module(sqlservr+00032F55) (CStmtSelect::XretExecute+00000229)* 0040F403 Module(sqlservr+0000F403) (CMsqlExecContext::ExecuteStmts+000002D9)* 0040EA95 Module(sqlservr+0000EA95) (CMsqlExecContext::Execute+000001B6)* 00410159 Module(sqlservr+00010159) (CSQLSource::Execute+00000331)* 005F74B6 Module(sqlservr+001F74B6) (CStmtExecStr::XretExecute+0000032E)* 0040F403 Module(sqlservr+0000F403) (CMsqlExecContext::ExecuteStmts+000002D9)* 0040EA95 Module(sqlservr+0000EA95) (CMsqlExecContext::Execute+000001B6)* 00410159 Module(sqlservr+00010159) (CSQLSource::Execute+00000331)* 00429DD3 Module(sqlservr+00029DD3) (execrpc+000004CB)* 0042904D Module(sqlservr+0002904D) (execute_rpc+00000019)* 00410FCE Module(sqlservr+00010FCE) (process_commands+00000210)* 41073379 Module(UMS+00003379) (ProcessWorkRequests+0000024A)* 41073071 Module(UMS+00003071) (ThreadStartRoutine+000000BD)* 7800A27B Module(MSVCRT+0000A27B) (beginthread+000000CE)* 77E5758A Module(KERNEL32+0000758A) (SetFilePointer+0000018A)
Resolution
SQL Server works with double-byte Unicode data internally; therefore, SQL Manager assumes an even length buffer.However, under some unexpected situations the buffer length can become an odd number. For example, this behavior might occur with an invalid Tabular Data Stream (TDS) language event. When the buffer length becomes an odd number, SQL Manager cannot allocate a sufficient memory block. This leads to a potential memory scratch and can cause the access violation that is described in the “Symptoms” section when the relevant memory block is freed later.

FIX: Extended Stored Procedure “xp_logevent” Generates an Access Violation When Given Too Large a Parameter

Symptoms
Any string that is longer than 8000 bytes that is given as a second parameter to the xp_logevent stored procedure, causes the following error message to occur:

ODBC: Msg 0, Level 19, State 1
SqlDumpExceptionHandler: Process 51 generated fatal exception c0000005
EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.
ODBC: Msg 0, Level 20, State 1
Stored function ‘xp_logevent’ in the library ‘xplog70.dll’ generated an
access violation. SQL Server is terminating process 51.
Resolution
To resolve this problem, obtain the latest service pack for SQL Server 2000. For additional information, click the following article number to view the article in theMicrosoft Knowledge Base:
290211?(http://support.microsoft.com/kb/290211/EN-US/) INF: How to Obtain the Latest SQL Server 2000 Service Pack

FIX: Exists with Full Outer Join May Generate Access Violation

Symptoms
When you execute a statement in which an EXISTS clause contains a FULL OUTER JOIN, an access violation may be raised, and you may receive the following error message:

SqlDumpExceptionHandler: Process 51 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.Connection BrokenThe SQL Server error log may contain an error similar to the following:

********************************************************************************* BEGIN STACK DUMP:*02/28/01 21:58:41 spid 51**Exception Address = 0055A73F (COptExpr::DeriveGroupProperties(unsigned long) + 00000016 Line 0+00000000)*Exception Code= c0000005 EXCEPTION_ACCESS_VIOLATION*Access Violation occurred reading address 00000014
Resolution
To resolve this problem, obtain the latest service pack for SQL Server 2000. For additional information, click the following article number to view the article in theMicrosoft Knowledge Base:
290211?(http://support.microsoft.com/kb/290211/EN-US/) INF: How to Obtain the Latest SQL Server 2000 Service Pack