Why my DCOM service reports 10010 error
Symptom
Sometimes we will get the following error message for your DCOM service in the System event log.
Event Type: Error
Event Source: DCOM
Event Category: None
Event ID: 10010
Date: 8/26/2009
Time: 2:35:34 PM
User: XXXX
Computer: XXXX
Description:
The server {61FE47D1-3474-4716-B13E-4ADC413FD4F1} did not register with DCOM within the required timeout.
Root Cause
This problem always happens when your DCOM service is running while its class factories haven’t been registered properly.
Analysis
How to reproduce the issue?
If we create a DCOM service with VC 6.0 as this article, and add a simple ATL COM object: https://www.codeproject.com/KB/COM/HelloTutorial1.aspx
With the default source code, we comment the _Module.RegisterClassObjects line, it means the class factories will never have the chance to be registered. Actually the ATL object is finally registered by RegisterClassObjects, so that the object can be activated in runtime.
void CServiceModule::Run()
{
……
/*
hr = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER, REGCLS_MULTIPLEUSE);
_ASSERTE(SUCCEEDED(hr));
*/
LogEvent(_T("Service started"));
if (m_bService)
SetServiceStatus(SERVICE_RUNNING);
……
}
In this situation, if the DCOM client tries to connect to the DCOM server, the DCOM 10010 error will be logged in the system event log. However, the behavior will be different for Win2K and Win2K3.
On Win2K, the error event will be logged after 30 seconds and the process will be terminated if the service is not started ahead. But the service will keep on running if it is already started before.
On Win2K3, the error event will be logged after 120 seconds and the process will keep on running, no matter whether the service has already been started or not.
Why does this happen?
This error happens in the RPCCS activation server Stage (CScmActivator), and the call stack could be like this:
ChildEBP RetAddr
008bf5a4 757f87ab ADVAPI32!ReportEventW
008bf628 757ee452 rpcss!LogRegisterTimeout+0x6c
008bf674 757dd2a6 rpcss!CServerTableEntry::StartServerAndWait+0x35b
008bf6d0 757d629c rpcss!Activation+0x38a
008bf728 757dc4e8 rpcss!ActivateFromProperties+0x1c2
008bf734 757dc525 rpcss!CScmActivator::GetClassObject+0xd
008bf75c 757dc544 rpcss!ActivationPropertiesIn::DelegateGetClassObject+0xef
008bf7a4 757d595b rpcss!ActivateFromPropertiesPreamble+0x3a7
008bf7e8 757dc4cd rpcss!PerformScmStage+0xa8
008bf8e0 7800378e rpcss!SCMActivatorGetClassObject+0x64
008bf90c 780781a5 RPCRT4!Invoke+0x30
008bfd00 7807859d RPCRT4!NdrStubCall2+0x1fb
008bfd1c 78002d2a RPCRT4!NdrServerCall2+0x17
008bfd50 78002ca7 RPCRT4!DispatchToStubInC+0x38
008bfdac 78002bb1 RPCRT4!RPC_INTERFACE::DispatchToStubWorker+0x132
008bfdd0 78009059 RPCRT4!RPC_INTERFACE::DispatchToStub+0x82
008bfe08 78008e95 RPCRT4!LRPC_SCALL::DealWithRequestMessage+0x351
008bfe2c 78001721 RPCRT4!LRPC_ADDRESS::DealWithLRPCRequest+0x16b
008bff90 78001601 RPCRT4!LRPC_ADDRESS::ReceiveLotsaCalls+0x298
008bff94 780019d6 RPCRT4!RecvLotsaCallsWrapper+0x9
005cffac 780015f3 RPCRT4!BaseCachedThreadRoutine+0x64
005cffb4 77e5d33b RPCRT4!ThreadStartRoutine+0x16
005cfff0 780015dc kernel32!BaseThreadStart+0x37
In the rpcss!CServerTableEntry::StartServerAndWait function, it will check if the class objects are registered.
On Win2K
It checks the registration every 30 seconds in an endless loop. If the objects haven’t been registered, the callback function of Handler will be called with the control code of SERVICE_CONTROL_INTERROGATE. After that, if the service is not started before activation and its current status is SERVICE_RUNNING, RPCSS will send out SERVICE_CONTROL_STOP to stop the service and finally report the DCOM 10010 error event.
On Win2K3
It also checks the registration every 30 seconds and it only checks 4 times at most. If the objects haven’t been registered, the callback function of Handler will be called with the control code of SERVICE_CONTROL_INTERROGATE. After that, if the service status is SERVICE_RUNNING, it will keep on looping until 4 times. This is why it reports the DCOM 10010 event after 120 seconds.
Suggestion
It is recommended to register the class factories as early as possible. The COM objects only can be activated after they are registered with RegisterClassObjects function.
References
SERVICE_STATUS Structure: https://msdn.microsoft.com/en-us/library/ms685996(VS.85).aspx
Handler Callback Function: https://msdn.microsoft.com/en-us/library/ms683240(VS.85).aspx
CComModule::RegisterClassObjects: https://msdn.microsoft.com/en-us/library/69c22y1d(VS.71).aspx
Regards,
ZhiXing Lv