KSOURCE_WAKEUP Wait Type in SQL Server

KSOURCE_WAKEUP is recorded by SQL Server’s background control task while it waits to be told, by the Windows Service Control Manager, to shut the instance down. One thread (typically SPID 7 or thereabouts) holds this wait for the entire life of the instance.

Its accounting quirk: sys.dm_os_wait_stats shows it with near-zero time because the wait never completes, while sys.dm_os_waiting_tasks and sys.dm_exec_requests show the session with an ever-increasing wait time since startup. Both views are telling the truth.

Is It a Problem?

No; long waits are expected and documented as such. It is the instance’s shutdown listener doing exactly what a listener does: nothing, attentively. It appears in every “system process with huge wait time” screenshot that worries someone new to the DMVs.

There is nothing behind it to tune, monitor, or fix.

Common Causes

  • The instance running as a Windows service, which is to say: always.

What To Do

  1. Filter it out, and recognise its session in sys.dm_exec_requests as a permanent system resident, not a stuck query.
  2. Use it as a teaching example: system sessions (SPIDs below ~50) routinely show enormous benign waits, and killing or worrying about them is never the move.

How To See It

Rank waits with Get-WaitStatistics, where it is filtered; its live session is visible in sys.dm_exec_requests with its ever-growing wait.


Part of the SQL Server Wait Types Library.
Related deep dive: SOS_SCHEDULER_YIELD Wait Type.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *