CLR_SEMAPHORE Wait Type in SQL Server

⏳Part of the SQL Server Wait Types Library, every wait type explained.Related deep dive: SOS_SCHEDULER_YIELD Wait TypeRelated pillar: Performance & Troubleshooting

Is It a Problem?

Usually not. It is commonly filtered as benign and is not a known contention point; it was zero on our SQL Server 2025 lab. Get Wait Statistics does not filter it out, so if it ranks, you will see it.


What It Means

Microsoft’s definition: a task performing CLR execution, and is waiting for a semaphore. A semaphore gates access to a limited resource, so a thread waits here until a slot frees.


When It Does Matter

On a server with substantial custom CLR code. If it grows, look at whether your CLR code holds the resource behind a semaphore for a long time. That makes it a code review prompt, not a server setting. List the user assemblies in the database:

SELECT
    a.name AS assembly_name,
    a.permission_set_desc,
    a.create_date
FROM sys.assemblies AS a
WHERE a.is_user_defined = 1;

The baseline to monitor is its wait time per interval next to the run times of the CLR routines that use it.


The CLR Family

These are the SQL CLR waits: CLR worker threads idling, and the work of loading assemblies and application domains. Most are commonly filtered as benign. If one is near the top of your waits, start from the waits that usually matter instead.

  • CLR_AUTO_EVENTAuto-reset event. A CLR task waiting on an auto-reset event; long waits are typical.Usually noise
  • CLR_MANUAL_EVENTManual-reset event. A CLR task waiting on a manual-reset event.Usually noise
  • CLR_SEMAPHORESemaphore. A CLR task waiting for a semaphore.Usually noise. This page.
  • SQLCLR_APPDOMAINApp domain startup. Waiting for a CLR application domain to finish starting.Worth a look when it climbs
  • SQLCLR_ASSEMBLYAssembly list. Waiting for access to the loaded assembly list in the app domain.Usually noise
  • ASSEMBLY_LOAD and assembly waitsAssembly loading. Exclusive access while an assembly loads.Usually noise

Where To Go Next

CLR_SEMAPHORE is usually zero. If you are chasing a real problem, start with the waits that cost you time.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *