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 ‘exception’

FIX: SQLAgent Exception Occurs when the System Maintains 613, 2661 or 4709 Jobs

Symptoms
The SQLAgent process may terminate with with following error messages:

2001-01-14 19:21:11 – ! [LOG] Exception 5 caught at line 335 of file ..\src\job.c.SQLServerAgent initiating self-termination
2001-01-14 19:21:29 – + [098] SQLServerAgent terminated (forcefully)
Resolution
SQLAgent creates a memory structure to support the xp_sqlagent_enum_jobs action. With SQL Server 2000 the structure is 588 bytes plus 4 bytes for overhead. However, an incorrect CAST to a LPTSTR, instead of a LPBYTE, results in an incorrect 4 byte shift.
When the (number of created jobs on the system * 588) + 4 = NT Page boundary the incorrect 4 byte cast results in the exception.

FIX: SQL Server Fails to Start When Computer Binds 48 or More Socket Addresses

Symptoms
Binding 48 or more addresses to the network of a SQL Server computer causes an access violation exception to occur and the SQL Server server fails to start.
The exception that is logged to the SQL Server error log is:

42CF1ABA Module(SSNETLIB+00001ABA) (ConnectionListen+000008CA)004E2CFA Module(sqlservr+000E2CFA) (FRunCM(class StartUp *)+000000D3)004E3FA3 Module(sqlservr+000E3FA3) (initCM(void *)+00000064)7800BEA1 Module(MSVCRT+0000BEA1) (_beginthread+000000CE)From build 8.00.194
Resolution
The Ssnetlib.dll file attempts to listen on the first 64 socket addresses. A buffer overrun occurs, which causes the exception.

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 Hash Join with Empty Result Set Incorrectly Flows Error Back on Client Connection

Symptoms
If you run a SQL Server Data Manipulation Language (DML) statement from a DB-Library based application against a Microsoft SQL Server 7.0 server, the error handler for the application may incorrectly fire and only report the following error message:

DB-LIBRARY Error 10007, Severity 5:
General SQL Server error: Check messages from the SQL Server.Note that this error message accompanies a wide range of SQL Server errors that are reported back to the client from the server. However, in this scenario the preceding error message is the only error reported and it is not accompanied by any other specific error messages.
Resolution
If a parallel hash join produces an empty result set, internal exception 3602 is used to coordinate the shutdown of worker threads that were created to process the parallel hash plan. The internal 3602 exception is an internal control exception that is used to direct processing flow inside SQL Server and is expected behavior in this case.
However, the fact that it is causing an error to be sent back on the client connection, which in turn causes the DB-Library error handler to fire is not expected behavior.

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: Index Scans on Frequently Modified Table May Return Incorrect Results

Symptoms
Under rare conditions where connections concurrently modify and read data on a particular page, a query that performs a range scan on the page may return rows that do not qualify for the specified range. The end result is that a query may return extra rows that should not qualify for the query.
This problem may affect the distribution agents in transactional replication. When the Distribution Agent receives unexpected rows while querying the MSrepl_commands table it causes an access violation (AV) exception in Distrib.exe that shuts down the agent. The following text may appear in the ReplExceptDist.log:

Microsoft SQL Server Replication: Exception Stack Dump…An exception was caughtin DISTRIB.EXE* Exception Address = 7801166c* Exception Code = c0000005********************************************************Module Name Return Address LocationMSVCRT 00403a45 wcsncpy + 14distrib 0040104c 00403a45distrib 77e97d08 0040104cKERNEL32 00000000
Resolution
To resolve this problem, obtain the latest service pack for Microsoft 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
HotfixNOTE: The following hotfix was created prior to Microsoft SQL Server 2000 Service Pack 2. The English version of this fix should have the following file attributes or later:

VersionFile nameDescription————————————————8.00.468Sqlservr.exeSP1-based hotfix Hotfix build 468 is designed to be applied to a server that is running SQL Server 2000 Service Pack 1.
NOTE: Due to file dependencies, the most recent hotfix or feature that contains the preceding files may also contain additional files.