FIX: Possible assertion failure when a cross-database transaction involving an Availability Group database is committed from a SQL Server trigger

Applies to: SQL Server 2016 DeveloperSQL Server 2016 EnterpriseSQL Server 2016 Enterprise Core More


Assume that you have at least one AlwaysOn Availability Group with DTC_SUPPORT=PER_DB in Microsoft SQL Server 2016 or 2017. If you execute a SQL Server trigger that contains a cross-database transaction involving at least one of the Availability Group databases, an assertion failure may occur. The SQL Server error log reports the following assertion failure messages:

DateTime spid20s     * *******************************************************************************
DateTime spid20s     * BEGIN STACK DUMP:
DateTime spid20s     * Location:     FileName:3880
DateTime spid20s     * Expression: m_state == BaseXact::XACT_PREPARED || m_state == BaseXact::XACT_COMMITTED
DateTime spid20s     * SPID:                            20

DateTime spid20s     Error: 17066, Severity: 16, State: 1.
DateTime spid20s     SQL Server Assertion: File: <FileName>, line=LineNumber Failed Assertion = 'm_state == BaseXact::XACT_PREPARED || m_state == BaseXact::XACT_COMMITTED'. This error may be timing-related. If the error persists after rerunning the statement, use DBCC CHECKDB to check the database for structural integrity, or restart the server to ensure in-memory data structures are not corrupted.
DateTime spid20s     Error: 3624, Severity: 20, State: 1.
DateTime spid20s     A system assertion check has failed. Check the SQL Server error log for details. Typically, an assertion failure is caused by a software bug or data corruption. To check for database corruption, consider running DBCC CHECKDB. If you agreed to send dumps to Microsoft during setup, a mini dump will be sent to Microsoft. An update might be available from Microsoft in the latest Service Pack or in a Hotfix from Technical Support.

Additionally, you may receive an error message that resembles the following:

DateTime Server      Error: 19407, Severity: 16, State: 1.

DateTime Server      The lease between availability group 'GroupName' and the Windows Server Failover Cluster has expired. A connectivity issue occurred between the instance of SQL Server and the Windows Server Failover Cluster. To determine whether the availability group is failing over correctly, check the corresponding availability group resource in the Windows Server Failover Cluster.


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


Cumulative Update Information:

This issue is fixed in the following cumulative updates for SQL Server:

About cumulative updates for SQL Server:
Each new cumulative update for SQL Server contains all the hotfixes and all the security fixes that were included with the previous cumulative update. Check out the latest cumulative updates for SQL Server:

On-Demand Hotfix Information:

This issue is fixed in the following on-demand hotfixes for SQL Server:


Learn about the terminology that Microsoft uses to describe software updates.