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

Why This Error Happens

Error 5857 in SQL Server 2025 is typically raised when the Database Engine’s parallel redo or scheduler component detects a mismatch between the configured CPU affinity mask and the actual logical processors available to the instance, often following a Windows Server 2025 kernel scheduling update or a NUMA node reconfiguration. This causes SQL Server to spin up excessive worker threads attempting to recalculate scheduler-to-core mappings, which manifests as sustained high CPU utilization. In virtualized or containerized deployments, this is frequently triggered by a mismatch between the hypervisor’s exposed vCPU topology and the NUMA configuration SQL Server detects at startup.

Step-by-Step Resolution Guide

Step 1: Verify Current CPU Affinity and Scheduler Configuration

  • Open SQL Server Management Studio (SSMS) and run SELECT * FROM sys.dm_os_schedulers WHERE status = 'VISIBLE ONLINE'; to check active scheduler count.
  • Cross-reference this with SELECT cpu_count, hyperthread_ratio, softnuma_configuration FROM sys.dm_os_sys_info;
  • Confirm whether the visible scheduler count matches the actual logical CPUs assigned in Windows Server 2025 Task Manager > Performance > CPU.

Step 2: Reset the Affinity Mask and NUMA Configuration

  • Open SQL Server Configuration Manager, right-click the SQL Server service, and select Properties.
  • Navigate to the “Advanced” tab and reset Affinity Mask and Affinity I/O Mask to default (0), allowing SQL Server to auto-detect topology.
  • Alternatively, run the T-SQL command:
  ALTER SERVER CONFIGURATION SET PROCESS AFFINITY CPU = AUTO;
  • Restart the SQL Server service via net stop MSSQLSERVER followed by net start MSSQLSERVER.

Step 3: Update Soft-NUMA Settings in the Registry

  • Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQLServer\NodeConfiguration.
  • Remove or correct any stale NUMA node entries that no longer correspond to physical cores exposed by Windows Server 2025 (especially after a VM resize or host migration).
  • Save changes and restart the SQL Server service for the new topology to take effect.

Step 4: Apply the Latest Cumulative Update

  • Check SELECT @@VERSION; to confirm the current build number.
  • Download and install the latest SQL Server 2025 Cumulative Update (CU) from the Microsoft Update Catalog, as this specific scheduler/NUMA detection bug is addressed in several post-RTM patches.
  • Reboot the server after installation to fully clear cached topology data.

Alternative or Verification Steps

  • After applying the fix, monitor CPU usage for 15–30 minutes using Performance Monitor (Process > % Processor Time for sqlservr.exe) to confirm it stabilizes below baseline thresholds.
  • If CPU spikes persist, run DBCC FREEPROCCACHE and DBCC DROPCLEANBUFFERS (in a non-production environment only) to rule out plan cache bloat as a contributing factor, then re-check sys.dm_os_schedulers for scheduler count accuracy.