FIX: XA transactions aren't cleaned when you exit a Java application in an instance of SQL Server

Applies to: Microsoft SQL Server 2012 Service Pack 3SQL Server 2016 DeveloperSQL Server 2016 Enterprise More

Symptoms


You have a Java application that connects to Microsoft SQL Server by using the Microsoft JDBC Driver for SQL Server. After the Java application starts, you run one or more XA transactions in the instance of SQL Server. When you exit the Java application, those transactions are not cleaned until you restart the instance of SQL Server. Additionally, if there are too many orphaned transactions, you may be unable to start any new transactions in the instance of SQL Server.

Resolution


To resolve this issue, apply this update, and then enable trace flag TF3924. To enable trace flag TF3924, see the "More Information" section. 

Cumulative update information

This issue is fixed in the following updates:

Status


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

More Information


To check for orphaned transactions, run the following Transact-SQL statement in the instance of SQL Server:
SELECT * FROM sys.syslockinfo L, sys.dm_tran_active_transactions T WHERE L.[req_transactionUOW] = T.[transaction_uow]

How to enable trace flag 3924

You can enable trace flag 3924 at startup or in a user session. This trace flag has either global-level or session-level effects. To enable trace flag 3924, use the DBCC TRACEON command or use –T 3924 as a startup parameter.

If DBCC TRACEON\TRACEOFF is used, this does not regenerate a new cached plan for stored procedures. There could be plans in the cache that were created without the trace flag.

For more information about how to enable or disable trace flags and about global and session-level trace flags, see the following topics in SQL Server Books Online:

References


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