SQL Server Agent – Managing Thousands of Sleeping Connections

sql serversql server 2014

In a recent monitoring session I noticed that one of our main MSSQL 2014 databases had an increasing number of open connections.

It started with more than 1000 open connections, and now after two weeks it has increased to more than 2600. One would think that this would be improper connection handling in one of our applications, but out of the 2610 open connections, 2600 belong to SQLSERVERAGENT. When inspecting the result of sp_who2, almost all SQL Server Agent connections are program name 'SQLAgent – Temporary Worker', sleeping and 'awaiting command'.

I've searched for threads on improper behavior on the SQL Server Agent side, but almost all results talk about applications not closing their db connections properly. It seems to me that the jobs performed by the SQL Server Agent are not correctly being closed?

Best Answer

KB 3034297 - Cumulative Update 6 for SQL Server 2014 describes the issue that you are encountering and is fixed in SQL Server 2014 CU6

When you turn on SQL Server Managed Backup in Microsoft SQL Server 2014. When you let SQL Server and SQL Server Agent run for several days, there are many connections with the program name SQLAgent - Temporary Worker. They are created by "sqlagent.exe," and cannot be closed.