RPC_E_CLIENT_DIED (0X80010008): Disappearing Client Fix
Client disconnected mid-call? Here's why that kills your COM server and how to stop it from crashing your app.
What's Happening?
You're running a COM-based server—maybe a custom Windows service, an in-process COM object, or a distributed COM (DCOM) setup—and suddenly you hit RPC_E_CLIENT_DIED (0x80010008). I first saw this when a web app talking to a legacy COM+ component kept dying under load. The trigger? The client process (your app, script, or browser) got killed, crashed, or timed out while the server still had an active call from that client. The server's COM runtime detected the client's gone and returns this error. Specifically, this hits when the server tries to complete or send a response back to a client that's no longer connected. It's not a network issue—it's a client lifespan problem.
Root Cause
Think of COM calls like a phone call. The client dials, the server picks up, they chat. If the client hangs up without warning—because the user closed the app, your code threw an unhandled exception, or a timeout killed the thread—the server's still holding the line yelling 'hello?'. The COM runtime catches this and raises RPC_E_CLIENT_DIED. The server interface pointer for that call is now orphaned.
Common triggers:
- Client process crashes (e.g., browser tab crash with ActiveX)
- Client app closes before async COM calls finish
- Network disconnect in DCOM scenarios
- Thread or process killed by Task Manager during a COM call
The Fix: Step by Step
Step 1: Identify the Orphaned Call
First, confirm which client is dying. Use Process Explorer or tasklist /m to see which processes hold COM references to your server. On the server side, enable COM call monitoring in the Windows Event Log under Applications and Services Logs > Microsoft > Windows > COM > Operational. Look for Event ID 1008 or 1009—those are your smoking gun.
Step 2: Wrap Server Code in Exception Handling
The server must catch client disconnects gracefully. In your COM method implementations (C++ or C#), add a try-catch around the entire method body. If RPC_E_CLIENT_DIED is thrown, log it and return a clean failure instead of crashing the server. In C++:
HRESULT MyServerMethod() {
try {
// your work here
} catch (const _com_error& e) {
if (e.Error() == RPC_E_CLIENT_DIED) {
// client's gone, no point continuing
return S_OK; // or E_FAIL, but don't crash
}
throw;
}
return S_OK;
}Step 3: Set Client Timeout to Match Server Processing
On the client side, increase the DCOM timeout or set a proper call timeout to avoid premature disconnects. In registry: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Ole\DefaultCallTimeout. Set it to a DWORD value in milliseconds. I set mine to 60000 (60 seconds) for I/O-heavy calls. If the client's using CoWaitForMultipleHandles, check that it's not timing out too early.
Step 4: Use Async Patterns for Long Operations
If your server does work that takes more than 30 seconds, don't block the client. Switch to an asynchronous COM pattern—fire-and-forget with a callback or use ICallbackWithNoWait. This way, if the client dies, the server can complete without trying to talk to a ghost.
[Implement ICallbackWithNoWait on the server]
// Client calls method, server returns immediately, work continues on server thread.
// Client can disconnect safely—server won't notice or care.Step 5: Monitor and Restart Orphaned Server Objects
If you can't prevent client disconnects (e.g., users force-close apps), add a watchdog in your server. After each call, check if the caller's interface pointer is still valid using IUnknown::AddRef and Release—if AddRef fails, the client's gone. Or use a separate health-check thread that pings clients periodically.
Still Failing? Check These
- Are you using DCOM? The error can also come from network-level disconnects. Verify firewalls aren't dropping RPC ports (135, 1024-65535 dynamic).
- Check the client's event logs. The client might be crashing silently. Look for Application Error events (Event ID 1000) in Windows Event Viewer.
- Is your server single-threaded? A STA (Single-Threaded Apartment) server can deadlock if a client disconnects while marshaling calls. Switch to MTA (Multi-Threaded Apartment) for better resilience.
- Update your COM runtime. On Windows 10/11, ensure you have the latest cumulative update—Microsoft fixed a similar bug in KB5005101 for Win10 20H2.
Was this solution helpful?