For the past month, one of my servers is facing issues with SQL Server Agent. It stops automatically with below error, which happens randomly:
Sql Agent Output file
 Memory leak detected [204 bytes]
Exception 5 caught at line 403 of file e:\sql9_sp2_t\sql\komodo\src\core\sqlagent\src\alerter.cpp. SQLServerAgent initiating self-termination
I googled this error but did not get much info about it. Both SQL Server and Agent are running with the same domain account; however, the issue is only with the SQL Server Agent service.
I am also unable to see the SQL Server Agent service in SQL Server Configuration Manager. I checked the SQL Server error log, and Windows Event Viewer logs, but did not see any suspicious activity.
My memory settings are configured correctly. The server has 32GB RAM and SQL Server is assigned to use max memory of 26GB.
- SQL Server 2012 SP2 Std Edition 11.0.5058 64 bit
- Windows Server 2008 R2 Ent Edition 64 bit
- Dedicated to SQL Server (no other apps run on the server)
- The server was upgraded a few months ago from SQL Server 2005 EE to 2012 SE.
- We are not using an Events Forwarding Server.
I checked the msdb database as well. Ran checkdb on it and it completed successfully without any errors. I need your help in fixing two things:
- To fix the random stopping of SQL Server Agent service
- To add SQL Server Agent service in SQL Server Configuration Manager
We have third-party software for monitoring, so we get notified immediately if the agent service stops. For now we are just restarting the service. But we want to find the root cause.
I ran the following query suggested by Sean Gallardy and got 95 rows back. I don't know how to interpret the result.
select * from sys.dm_os_loaded_modules where name not like '%microsoft%'
Unfortunately I cannot post the results for security reasons.
Until I find the solution to this problem I have added retry attempts to the SQL Server Agent so that it can restart automatically when it gets stopped.