How to fix Error 13138 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 13138 – “Execs Started Per Second”

Why This Error Happens

Error 13138 in SQL Server 2025 is typically triggered by the Extended Events engine when monitoring the sql_statement_starting or stored_procedure_started actions, indicating an abnormal spike in execution requests per second that exceeds the configured threshold for the Resource Governor or diagnostic session. This condition often arises from missing permissions on the Extended Events session target file path, a misconfigured Resource Governor workload group limit, or a corrupted .xel trace file that prevents the session from flushing buffered events correctly. In high-concurrency environments, this can also surface due to Windows Server 2025 security policies blocking SQL Server’s service account from writing to the event tracing directory.

Step-by-Step Resolution Guide

Step 1: Verify SQL Server Service Account Permissions

  • Open Services.msc on Windows Server 2025 and confirm the account running MSSQLSERVER has write access to C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\.
  • Right-click the folder, go to Properties > Security, and ensure “Full Control” is granted to the SQL Service account.
  • Restart the SQL Server service after applying permissions: net stop MSSQLSERVER && net start MSSQLSERVER.

Step 2: Inspect and Reset the Extended Events Session

  • Run the following query in SSMS to check active sessions: SELECT * FROM sys.dm_xe_sessions WHERE name = 'system_health';
  • If the session is stalled, drop and recreate it using: DROP EVENT SESSION [system_health] ON SERVER; followed by restoring the default session script from the SQL Server installation media.
  • Clear any corrupted .xel files found in the log directory identified in Step 1.

Step 3: Adjust Resource Governor Workload Group Limits

  • Navigate to Object Explorer > Management > Resource Governor in SSMS.
  • Increase the REQUEST_MAX_CPU_TIME_SEC and MAX_DOP values for the affected workload group to accommodate the execution spike.
  • Apply changes using: ALTER RESOURCE GOVERNOR RECONFIGURE;

Step 4: Update SQL Server 2025 Cumulative Update

  • Check the current build version: SELECT @@VERSION;
  • Download the latest Cumulative Update (CU) from the Microsoft Update Catalog specific to SQL Server 2025.
  • Install the patch in a maintenance window and reboot the Windows Server 2025 host to finalize driver-level fixes related to the Extended Events engine.

Alternative or Verification Steps

  • To verify the fix, monitor the Batch Requests/sec counter in Performance Monitor (PerfMon) for 30 minutes to ensure it stabilizes without triggering Error 13138 in the SQL Server Error Log.
  • If the error persists, bypass the Extended Events session entirely by switching to SQL Server Profiler (legacy trace) temporarily to isolate whether the issue is specific to the XEvents engine or a deeper Resource Governor conflict.