FIX: Non-yielding scheduler tries to close the listener for availability group in SQL Server 2012

Applies to: SQL Server 2012 DeveloperSQL Server 2012 EnterpriseSQL Server 2012 Standard


Consider the following scenario:
  • You have deployed a SQL Server AlwaysOn availability group and availability group listener.
  • AlwaysOn health detection detects a health issue with the SQL Server hosting the primary replica and begins transitioning the availability group from the primary role to the resolving role. Part of this involves taking the availability group listener resource offline.
  • The operation trying to stop the listener resource may not finish and SQL Server non-yielding dump diagnostic reports the crash as a ‘Non-yielding scheduler’ in the SQL Server error log.
  • The operation may crash indefinitely when trying to stop the availability group listener if left unattended.
In this scenario, availability databases in the availability group stay in recovery mode, and cannot be brought online. You receive the following errors:
<Date> <Time> <Server Name>    ***Unable to get thread context for spid 0
<Date> <Time> <Server Name>      *
<Date> <Time> <Server Name>      *
<Date> <Time> <Server Name>      * BEGIN STACK DUMP:
<Date> <Time> <Server Name>      *   <Date> <Time> spid 1068
<Date> <Time> <Server Name>      *
<Date> <Time> <Server Name>      * Non-yielding Scheduler
<Date> <Time> <Server Name>      *
<Date> <Time> <Server Name>      *
<Date> <Time> <Server Name>      Stack Signature for the dump is 0x0000000000000176


The issue occurs because the thread shuts down the listener resource freeze and does not yield. This non-yielding thread blocked other threads on the same processor that blocked other threads trying to recover the availability databases.


The issue was first fixed in the following cumulative update of SQL Server.

Cumulative Update 9 for SQL Server 2012 SP1


Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.