FIX: Reading a Profiler Trace with the ::fn_trace_gettable Function and SPID 1000 Might Cause Errors (325197)



The information in this article applies to:

  • Microsoft SQL Server 2000 (all editions)

This article was previously published under Q325197
BUG #: 360090 (SHILOH_BUGS)

SYMPTOMS

If you use the :fn_trace_gettable function to read a SQL Profiler trace, an access violation or various other error messages might occur when all the following conditions are met:
  • The trace file contains events for server process ID (SPID) 1000.
  • The first event for SPID 1000 comes before any events for SPIDS that are greater than 1000.
  • The trace captured one or more of the following columns:
    • ServerName
    • NTUserName
    • NTDomainName
    • LoginName
    • LoginSid
    • ClientProcessID
    • ApplicationName
    • HostName
Here is a sample query that might cause an access violation, if all the conditions in the list are met:
select * from ::fn_trace_gettable(<trace_file>, 1)	
Because the bug causes the routine to write beyond the bounds of an array, it has the potential to overwrite data structures that are used by other connections; therefore, it can cause those connections to experience various failure conditions.

CAUSE

The listed events are repeatable events. The values reported for each of the columns is always the same for the duration of that SPID's connection. An optimization is in place whereby the server only sends these values one time; thereafter, it references the repeated column value.

When reading the trace file, ::fn_trace_gettable must maintain an array of these values so that they can be produced in the result set for any later rows. There is an error in the way that this array is resized when processing an event for SPID 1000.

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 the Microsoft Knowledge Base:

290211 INF: How To Obtain the Latest SQL Server 2000 Service Pack

NOTE: The following hotfix was created before the release of Microsoft SQL Server 2000 Service Pack 3.

The English version of this fix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.
   Date         Time   Version         Size             File name
   -----------------------------------------------------------------

   18-Jan-2002  04:45  2000.80.568.0      29,244 bytes  Dbmslpcn.dll     
   19-Nov-2002  19:50  2000.80.703.0   7,471,185 bytes  Sqlservr.exe     
   18-Jan-2002  04:45  2000.80.568.0      29,244 bytes  Ssmslpcn.dll     
				
Note: Because of file dependencies, the most recent hotfix or feature that contains the files may also contain additional files.


WORKAROUND

Open the trace file with SQL Profiler. If you want to load the trace into a table, use the Save As functionality. To use the Save As functionality, on the File menu, click Save As, and then click to select Trace Table.

Note that if the trace file contains SPIDS that are greater than 1023, you have to use SQL Server 2000 Service Pack 1, or later, version of the client tools:

272737 FIX: SQL Profiler Generates Error when Reading Trace Files that Exceed 1023 SPIDs

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

This problem was first corrected in Microsoft SQL Server 2000 Service Pack 3.

Modification Type:MinorLast Reviewed:9/27/2005
Keywords:kbHotfixServer kbQFE kbSQLServ2000preSP3fix kbfix kbQFE kbbug kbpending KB325197