Board index » delphi » Multi-threaded, mission-critical DCOM servers, errors in Delphi COM implementation

Multi-threaded, mission-critical DCOM servers, errors in Delphi COM implementation

[This article discusses verified errors in the Delphi COM support and
how to deal with it.]

I am developing a set of specialized DCOM servers for my company and I'm
experiencing errors than seem not to be related to my own code.

Client and servers are initialized to use multi-threaded apartments
(COINIT_MULTITHREADED) and all interfaces are protected by local
synchronization objects (critical sections and mutexes). Single-threaded
apartments are not an option, for two reasons: (a) speed, and (b)
incompatibility with our architecture (lots of synchronization stuff and
asynchronous operations happening all over).

So far we've been using typelib marshaling, since our typelibs change
frequently we were going to put off building a proxy/stub factory DLL
until the final builds, but since this may be a factor we're going to try
this now.

The errors I get range from access violations in the apps and access
violations in oleaut32.dll to errors from the ORPC layer ("RPC server is
unavailable" etc.). I'm not precluding the possibility that we're dealing
with some minor but critical errors in our own source code, however large
parts of the Delphi COM framework seem not to be protected against
corruption in multi-threaded apps at all.

Secondly, I've written a skeleton client/server duo for testing where a
client creates multiple threads that each make repeated connections to
the server, and both the client and server crash in a consistent manner
depending on the load.

I've done my best to patch this non-support by creating my own thread-
safe versions of TComObject, TAutoObject, TInterfacedObject by adding
synchronization logic to AddRef/Release.

This synchronization logic adds significantly to the robustness of a DCOM
program but not enough because a lot of shared code is in Delphi's COM
units, comobj.pas and comserv.pas.

Delphi 3 has existed for more than a year now, we've had two maintenace
releases but no mention of fixes for the COM support. Surely there are
plenty of people around, including in this newsgroup, developing serious
(= multithreaded) DCOM stuff in Delphi. How are you handling this? How
is Inprise dealing with this?

--
Alexander Staubo . Developer . Medieoperat?rene .
http://www.mop.no/~alex/

 

Re:Multi-threaded, mission-critical DCOM servers, errors in Delphi COM implementation


Hello Alexander!

Alexander Staubo schrieb in Nachricht ...

Quote
>[This article discusses verified errors in the Delphi COM support and
>how to deal with it.]

>I am developing a set of specialized DCOM servers for my company and I'm
>experiencing errors than seem not to be related to my own code.

Take a very close look here http://www.castle.net/~bly/, where you not only
find an excellent article about COM and threading, but as well a single- and
multi-threaded appartment COM-server unit.
Hope that helps, see you

christoph
--
Interware GmbH                  Christoph Roeper
Dennewartstrasse 27           | Bismarckstrasse 29
D-52068 Aachen                | D-52066 Aachen
Tel +49 241 963 2680 / 2681   | Tel +49 241 536341
eMail i...@interware-gmbh.de  | eMail ro...@earthling.net

Other Threads