FIX: Decreased performance and long waits for CLR_AUTO_EVENT and CMEMTHREAD when SQLCLR UDT is used as a stored procedure parameter for a SQL RPC call

Aplica-se a: SQL Server 2012 EnterpriseSQL Server 2012 DeveloperSQL Server 2012 Enterprise Core

Symptoms


You use Microsoft SQL Server 2012, 2014 or 2016, and you create a User-defined type (UDT) by using SQL Server common language runtime (SQL CLR) integration.

If you use the UDT as a stored procedure parameter, the parameter is passed to the server through the remote procedure call (RPC) mechanism. This mechanism internally tries to load an assembly that hosts the UDT in memory.

In this situation, you may experience decreased performance for the stored procedure execution. This occurs because of an inefficiency that's caused when the RPC loads and unloads the SQLCLR assembly unnecesarily.

This problem is manifested as long wait times for CLR_AUTO_EVENT and CMEMTHREAD types. This is especially true if multiple concurrent users are running the same stored procedure.

Resolution


Service pack information for SQL Server

This update is fixed in the following service packs for SQL Server:

Service Pack 2 for SQL Server 2016

Service Pack 3 for SQL Server 2014

Service Pack 4 for SQL Server 2012

Status


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

References


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