Click here to Skip to main content
15,748,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
... how can the client release its reference?

Calling Release() on the pointer does not work. I think I got an RPC_E_DISCONNECTED error. I had this problem about five years ago and it was never fully fixed and the problem came up again in conversation and I was wondering if anyone has had experience with this.

manoranjan 12-Nov-12 0:01am    
Can you please be more specific? IUnknown->Release() returns a reference count and not HRESULT.

In any case you shouldn't bother releasing a crashed COM server. AddRef/Release mechanism is used to unload a COM server from memory. A crashed server is already unloaded (by the OS).
Michael Bergman 12-Nov-12 0:42am    
You are, of course, right about Release(). I knew that but I must have conflated that with another call that I made to access the object.

I don't think I can be more specific as this was five years ago, I but I think I can describe the problem a little more thoroughly.

There are three components:
1. An ActiveX control hosted in an application.
2. An Out-of-Proc COM Server which does work for the ActiveX control. The COM Server instantiates when call upon by the ActiveX control and closes when the ActiveX control closes with its host application.
3. Another Out-of-Proc COM Server which does work for the first COM Server. It is instantiated when the first COM Server calls it and it closes when it is released.

The problem is that the second COM Server crashes. We couldn't fix it because it was using propriatary API that we needed and that API was extremely buggy. Needless to say, it was a Microsoft API so we couldn't get them to fix it.

So what happens is:
ActiveX calls Server 1, gets a reference to Server 1
Server 1 call Server 2, Server 2 gets a reference to Server 1
Server 2 crashes,
Server 1 re-instantiates Server 2
Server 1 call Server 2 and get what it needs, Server 2 gets a reference to Server 1
Server 1 closes Server 2, Server 2 releases its reference to Server 1.
ActiveX host closes ActiveX control and releases its reference to Server 1
Server 1 does not close

Server 1 does not close because it still thinks the Server 2 which crashed still has a reference to it.

We were able to work around this problem, but it was a kludge. I was just wondering if anyone else had this particular problem (which I should have written more clearly the first time) and if they were able to resolve it.

Thanks for responding

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900