Home
Microsoft
First published on MSDN on May 20, 2008

SQL Server 2008 contains a new feature designed to help troubleshoot particularly tricky connectivity problems. This new feature, the Connectivity Ring Buffer, captures a record for each server-initiated connection closure, including each kill of a session or Login Failed event. To facilitate efficient troubleshooting, the ring buffer attempts to provide information to correlate between the client failure and the server’s closing action. Up to 1k records in the ring buffer are persisted for as long as the server is online, and after 1000 records, the buffer wraps around and begins replacing the oldest records. The Connectivity Ring Buffer’s records are exposed by a DMV which can be queried:

SELECT CAST(record AS XML) FROM sys.dm_os_ring_buffers
WHERE ring_buffer_type = 'RING_BUFFER_CONNECTIVITY'

This will select all records as XML types; in Management Studio, you can click the records to get a more readable version. If you want to use SQL queries on the XML records to locate your particular problem, you can also use SQL Server’s XML support to turn this into a temp table and query against the records.

A basic ring buffer entry: killed SPID

An easy way to cause a server-initiated connection closure is to open two connections to a SQL Server, find the SPID of one of the connections, and then kill that spid from the other connection:

C:>osql -E
1> SELECT @@spid
2> go
------
51
(1 row affected)

C:>osql -E
1> kill 51
2> go
1>

If you try this and then query the ring buffer, you will get a result which will look like this:

<Record id="2" type="RING_BUFFER_CONNECTIVITY" time="110448275">

<ConnectivityTraceRecord>

<RecordType>ConnectionClose</RecordType>

<RecordSource>Tds</RecordSource>

<Spid>55</Spid>

<SniConnectionId>B7882F3C-3BA9-45A7-8D23-3C5C05F9BDF9</SniConnectionId>

<SniProvider>4</SniProvider>

<RemoteHost>&lt;local machine&gt;</RemoteHost>

<RemotePort>0</RemotePort>

<LocalHost />

<LocalPort>0</LocalPort>

<RecordTime>5/6/2008 22:47:35.880</RecordTime>

<TdsBuffersInformation>

<TdsInputBufferError>0</TdsInputBufferError>

<TdsOutputBufferError>0</TdsOutputBufferError>

<TdsInputBufferBytes>60</TdsInputBufferBytes>

</TdsBuffersInformation>

<TdsDisconnectFlags>

<PhysicalConnectionIsKilled>0</PhysicalConnectionIsKilled>

<DisconnectDueToReadError>0</DisconnectDueToReadError>

<NetworkErrorFoundInInputStream>0</NetworkErrorFoundInInputStream>

<ErrorFoundBeforeLogin>0</ErrorFoundBeforeLogin>

<SessionIsKilled>1</SessionIsKilled>

<NormalDisconnect>0</NormalDisconnect>

<NormalLogout>0</NormalLogout>

</TdsDisconnectFlags>

</ConnectivityTraceRecord>

<Stack>

<frame id="0">0X01CA0B00</frame>

<frame id="1">0X01CA0DB1</frame>

<frame id="2">0X01DF6162</frame>

<frame id="3">0X02E53C98</frame>

<frame id="4">0X02E54845</frame>

<frame id="5">0X02E57BE9</frame>

<frame id="6">0X02E38F57</frame>

<frame id="7">0X02E3B2C0</frame>

<frame id="8">0X02E3C832</frame>