Microsoft JDBC Driver 4.2 contains a version of sqljdbc_xa which creates a handle leak in SQL Server

 

Recently I worked with a customer who was experiencing a crash in his SQL Server process. He was under the impression that this same code was working in another location but in this envirnonment, they were stressing the box to determine its capacity. That’s when they discovered the crash which eventually led us to find a handle leak in the process.

 

Steps To Verify Problem

1. Your application uses XA Transactions

2. The sqljdbc_xa.dll file version is 4.2.6420.100

3. Handle count increases with every call [task manager; performance monitor\process\handle count]

Log Name:      Application
Source:        Microsoft-Windows-Complus
Date:          6/8/2016 6:36:45 PM
Event ID:      4689
Task Category: (8)
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      SQL
Description:
The run-time environment has detected an inconsistency in its internal state. This indicates a potential instability in the process that could be caused by the custom components running in the COM+ application, the components they make use of, or other factors. Error in COM\complus\src\inc\UTSem.H(100), Insufficient system resources exist to complete the requested service.

: CreateEvent returned a NULL handle.

5. This state of affairs eventually leads to a crash in SQL Server Process

Recommendation:

Revert to 4.0 version of JDBC Driver: https://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=11774