Troubleshooting Guide: Error 9651 – System Call Failed During Service Broker or Database Mirroring Operation
Why This Error Happens
Error 9651 occurs when the underlying Windows networking stack rejects or fails a system call that SQL Server 2025 issues to establish or maintain a Service Broker or Database Mirroring endpoint connection. This is typically caused by a blocked or conflicting TCP port, insufficient permissions on the SQL Server service account to bind to the network socket, or corrupted/missing network provider components (such as the Winsock catalog) on Windows Server 2025 or Windows 11. It can also surface when a firewall, antivirus, or third-party network filter driver intercepts the socket operation before SQL Server can complete it.
Step-by-Step Resolution Guide
Step 1: Identify the Exact System Error Returned
- Open the SQL Server Error Log via SQL Server Management Studio (SSMS) or
C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG. - Locate the full text of Error 9651 — the
%lsplaceholder will contain a Windows system error code (e.g., “10048” for address already in use, or “10013” for permission denied). - Cross-reference the embedded Windows error code using
net helpmsg <code>in an elevated Command Prompt to get a plain-language description.
Step 2: Check for Port Conflicts on the Mirroring/Broker Endpoint
- Run
netstat -ano | findstr <port_number>(commonly 5022 for mirroring or 4022 for Service Broker) to see if another process is already bound to that port. - If a conflict exists, either stop the competing process or reassign the endpoint port using:
ALTER ENDPOINT Mirroring STATE = STOPPED;
ALTER ENDPOINT Mirroring AS TCP (LISTENER_PORT = 5023);
ALTER ENDPOINT Mirroring STATE = STARTED;
- Update firewall rules accordingly via
wf.mscornetsh advfirewall firewall add rule name="SQL Mirroring" dir=in action=allow protocol=TCP localport=5023.
Step 3: Verify Service Account Permissions and Socket Binding Rights
- Confirm the SQL Server service account (visible in SQL Server Configuration Manager) has “Log on as a service” rights and is not restricted by Group Policy.
- Check that the account is not blocked by
Network access: Restrict clients allowed to make remote calls to SAMpolicies undersecpol.msc. - Restart the SQL Server service after any permission changes:
net stop MSSQLSERVER && net start MSSQLSERVER.
Step 4: Repair the Winsock Catalog and Network Stack
- If the error code references a Winsock failure (e.g., 10050, 10051, 10060), reset the TCP/IP stack:
netsh winsock reset
netsh int ip reset
- Reboot the server after running these commands, as a stale or corrupted Winsock catalog frequently causes 9651 on freshly patched Windows Server 2025 builds.
Step 5: Disable Interfering Security Software Temporarily
- Temporarily disable third-party antivirus or endpoint protection network filters and retest the mirroring/broker session.
- If the issue resolves, add explicit exclusions for
sqlservr.exeand the relevant TCP ports in the security software’s configuration.
Alternative or Verification Steps
- After applying fixes, re-establish the mirroring session or Service Broker conversation and confirm no 9651 entries appear in the Error Log for at least one full sync cycle.
- As an alternative, use
sys.dm_tcp_listener_statesto verify the endpoint state is “Ready” and checksys.service_broker_endpointsto ensure the endpoint configuration matches expected port and state values.