(Republishing, or using this info in a commercial product/website, is prohibited without permission. All other uses are permitted. If in doubt, please ask.)

SHUTDOWN

(Back to main page…)

Description:

This wait type only occurs if a shutdown request is blocked waiting for queries being run by connections logged into the server as an sa user.

(Books Online description: “Occurs while a shutdown statement waits for active connections to exit.”)

Questions/comments on this wait type? Click here to send Paul an email, especially if you have any information to add to this topic.

Added in SQL Server version:

2008

Removed in SQL Server version:

N/A

Extended Events wait_type value:

The map_key value in sys.dm_xe_map_values is 188 in 2008 and 2008 R2, 194 in 2012, and 201 in 2014 RTM. After 2014 RTM, you must check the DMV to get the latest value as some map_key values have changed in later builds.

Other information:

I have not seen this wait type be a noticeable contention point.

If your SQL Server will not shut down, you will see at least one thread waiting for this wait type. To see what’s blocking the shutdown, look for any threads that are running and then investigate what those SPIDs are doing and potentially kill them if you need SQL Server to shut down as quickly as possible.

Known occurrences in SQL Server (list number matches call stack list):

  1. Waiting for an sa query to complete during a shutdown

Abbreviated call stacks (list number matches known occurrences list):

  1. SOS_Task::PostWait+0x9e
    EventInternal<SuspendQueueSLock>::Wait+0x2ca
    CStmtShutdown::XretExecute+0x79e
    CMsqlExecContext::ExecuteStmts<1,1>+0x427
    CMsqlExecContext::FExecute+0xa53
    CSQLSource::Execute+0x86c
    process_request+0xa57
    process_commands+0x4a3
    SOS_Task::Param::Execute+0x21e
    SOS_Scheduler::RunTask+0xab