COM Runtime Distribution in a Multithreaded Server Application

We experience intermittent crashes in the COM runtime in a large server application.

Here is what we have:

The server process running as a Windows service contains numerous freely distributed COM components written in C ++ / ATL. Several client processes written in C ++ / MFC and .NET use these components through cross proxy calls to COM calls (including .NET interaction) on the same computer. The OS is a Windows Server 2008 terminal server (32-bit). The entire software package was developed at home, we have the source code for all components. Trace toolkit records errors and exceptions that are thrown during operation.

What's happening:

After some random period of smooth sailing (from 5 days to 3 weeks), the COM server runtime falls apart with any combination of these symptoms:

  • RPC_E_INVALID_HEADER (0x80010111) - "OLE received a packet with an invalid header" returned to the caller in cross calls to server component methods
  • Call CoCreateInstance (CCI) for CLSCTX_LOCAL_SERVER
  • CoInitializeEx (COINIT_MULTITHREADED) call failed with CO_E_INIT_TLS (0x80004006)

  • All incoming COM operations continue to work, CCI works for CLSCTX_INPROC_SERVER.

  • The overall system remains responsive, SQL Server is running, no sign of problems outside of our maintenance process.
  • System resources are OK, memory leaks, abnormal CPU usage, lack of fraud

The only way is to restart the broken service.

() :

  • : Xeon 5 , 3 .
  • .NET Interop, .NET COM- .
  • .

, , . , .

- RPC_E_INVALID_HEADER HRESULT? . COM Runtime, COM, , , ? TLS (CO_E_INIT_TLS)?

+4
1

, .NET framework 4.0.

, .NET 4.0 (clr.dll: 4.0.30319.1), COM- .NET 4.5.1 (clr.dll: 4.0. 30319,18444)

:

MSDN: http://social.msdn.microsoft.com/Forums/pt-BR/f928f3cc-8a06-48be-9ed6-e3772bcc32e8/windows-7-x64-com-server-ole32dll-threads-are-not-cleaned-up-after-they-end-causing-com-client?forum=vcmfcatl

HRESULT RPC_X_BAD_STUB_DATA (0x800706f7) CoCreateInstanceEx (CLSCTX_LOCAL_SERVER) COM- ( ). , ole32.dll: EventPoolEntry:: s_initState, CCI , 0xbfff...

EventPoolEntry:: s_initState , . 0x8000 , 100 200+ , . s_initState 0xbfff, , . OP MSDN COM- , - 5 x init vs. 3 x cleanup.

s_initState , , .NET 4.5.1 4.0 .

+3

Source: https://habr.com/ru/post/1544516/


All Articles