0XC0020058

Fix Windows RPC_NT_NOT_CANCELLED (0XC0020058) Error

Server & Cloud Intermediate 👁 5 views 📅 Jun 29, 2026

This error means a thread couldn't be canceled in a remote procedure call. Usually it's a timing issue with a slow network resource or a stuck service.

What is the 0XC0020058 Error?

You see RPC_NT_NOT_CANCELLED (0XC0020058) when Windows tries to cancel a thread in a remote procedure call but the thread won't stop. I've hit this on Windows Server 2019 and Windows 10 Pro. It usually appears in event logs or during a system shutdown when a service hangs. The error itself says "The thread was not canceled." That's frustrating because it freezes things.

This tripped me up the first time too. The fix isn't complicated—you just need to find what's blocking the cancellation.

1. Network Timeouts on a Slow Resource

The most common cause: your app or service is waiting on a network resource that's slow or unreachable. For example, a file share on a remote server that's overloaded. The RPC call starts, but when it tries to cancel the thread (maybe during a timeout), the thread ignores the cancel request because it's stuck waiting.

The fix: Increase the RPC timeout. On Windows Server, you can do this via Group Policy or the registry. Here's the registry route:

  1. Open regedit as Administrator.
  2. Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Rpc. If you don't see the Rpc key, create it (right-click > New > Key).
  3. Create a DWORD (32-bit) called DefaultTimeout. Set it to 300000 (decimal) for 5 minutes. Default is 120000 (2 minutes).
  4. Also create a DWORD called MaximumRpcCallTimeout and set it to 300000.
  5. Reboot the server.

If you're on a workstation, you can also check your firewall. Sometimes a firewall blocks the RPC dynamic port range. Make sure ports 49152-65535 are open for inbound and outbound.

2. A Stuck Service or Deadlocked Thread

Another scenario: a service like spoolsv.exe (print spooler) or svchost.exe gets into a deadlock. It holds a lock and never releases it. When RPC tries to cancel a thread inside that service, it can't because the thread is waiting on a lock that's held by another thread.

The fix: Restart the affected service. But first, find which service is causing it. Check the System event log for warnings around the same time as the error. Look for a service that's hanging. In my experience, the Windows Time service (W32Time) or the DNS Client service cause this.

To restart a service quickly:

  1. Open Command Prompt as Admin.
  2. Type net stop <servicename> — for example, net stop w32time. If it stops, type net start w32time.
  3. If it won't stop, use taskkill /f /im svchost.exe but be careful—that kills all services in that host. Better to use sc queryex <servicename> to get the PID, then taskkill /pid XXXX /f.

If you see this error repeatedly, check if the service has a dependency that's failing. Use sc qc <servicename> to see dependencies.

3. DCOM Configuration Issues

Less common but real: DCOM (Distributed COM) settings are off. When an RPC call involves COM objects, the DCOM timeout can cause cancellation to fail. This happens a lot with SQL Server or Exchange Server when they talk over the network.

The fix: Adjust DCOM timeouts:

  1. Open dcomcnfg (Run > dcomcnfg).
  2. Go to Component Services > Computers > My Computer > Properties.
  3. Under the Default Protocols tab, ensure TCP/IP is listed and at the top.
  4. Under the Options tab, set "Enable COM Internet Services" to no (unless you need it).
  5. Set "Default Authentication Level" to Connect (not None).
  6. Set "Default Impersonation Level" to Identify.
  7. Apply and reboot.

You can also set a registry key to increase the DCOM timeout: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Ole, create a DWORD DefaultLaunchTimeout and set it to 120000 (2 minutes) or higher.

Quick-Reference Summary

CauseSymptomFix
Network timeout (slow resource)Error during file copy or network operationIncrease RPC timeout via registry (DefaultTimeout) or open firewall ports
Stuck service or deadlockSystem hangs, event log shows service delayRestart affected service; use taskkill if needed
DCOM misconfigurationError in SQL Server or Exchange ServerAdjust DCOM settings in dcomcnfg or increase DefaultLaunchTimeout

I've seen this error most often with network timeouts—especially on Windows Server 2019 when using SMB file shares over VPN. The thread just can't cancel because it's waiting for a network packet that never arrives. Increase the timeout and you're good. If it still happens, check the services next.

Hope this saves you the headache I had. You got this.

Was this solution helpful?