windows - detect client process termination from EXE COM Server -


I am writing an EXE COM server that exposes a system that locks the system resource in the normal execution client (Com executes off after a few seconds.) In unusual performance, the Client app crashes, leaving Com sec in the positive segment count with an example. The COM execution runs up to ~ 12 minutes This means that system resources have been locked during this time.

Is there any way to detect client termination as a socket IPC or driver protocol? It does not seem that COM is weak compared to other IPC mechanisms.

A few years ago I had only one question. I got the answer here :. In summary: No, there is no way to immediately detect client closure. Example:

When a COM client terminates normally, it releases all references to its server object. When a customer ends abnormally, there may be outstanding references to server objects. There is no way to know about the Ection mechanism without garbage collaboration, the resource code allocated to the COM object in the server code, which can then cause the resource leakage. To resolve this problem, COM uses an automated garbage collection mechanism in which the client uses the COM Resolver Process (RPCSS) on client machine ping on client machine ping.

The option of using COM's GC protocol (for example, using periodic application-level "pings" - method call, the object is notified that the client is still alive, or TCP ), Therefore, the default GC mechanism of DCOM should be used for any object, which should be closed when their clients disappear or the other Had behaved incorrectly, if those objects effectively become memory leaks on the server

Resolver on server machine The track ping duration of pings for each server object is 2 minutes and, at present, it is non-configurable. When the resolver on the server machine assumes that the object has not been pinged for 6 minutes, it assumes that all clients of the objects are terminated or otherwise the objects are not used. Resolver will then release all external references to the object. It does this by stubbing the object's stub manager (com runtime code which calls each object): Call on object's IUnknown interface :: Release () At this point, the reference count of the object must be zero, because the COM runtime Have a relationship. (There may still be references organized by local (similar-apartment) clients, so the internal reference number of the object can not be required at this time zero.) The object can be closed later on.

Note: Garbage collection applies to all servers whether their clients are local or remote, or local and remote combinations. The built-in pinging mechanism is different in the local case because no network packets are produced, but for all practical purposes, the behavior is the same.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -