Wednesday, January 17, 2007

COM+ Objects Created in Delphi and Hosted on Windows 2003

It seems that Windows 2003 has matured to the point where this is a pretty common server OS along with a dual or quad core processor. There have been reports that COM+ objects created with Delphi 2005 and 2006 can cause a loader-lock when started from Component Services. Just to get the word out, we found that in most cases the loader-lock can be circumvented starting the COM+ objects with a dead simple application containing only one button that calls CoCreateInstance on the COM+ object and immediately releases the interface. Since the COM+ object is registered with COM+ the object pool will be created and everything is fine (besides the ugly hack). I have also heard of some customers that set the timeout on the COM+ objects still encountering the loader-lock. Loader-locks are tricky bugs to track down and with each test case we get closer and closer to closing all the gaps, but obviously something changed in both Windows 2003 and Delphi 2005 to cause this unfortunate problem. If you think you have some information please drop me a comment on this blog or email me at codegearalias@gmail.com with the word "blog" anywhere in the message

2 comments:

Sebastian said...

One thing that really makes me suspicious is the call to (Safe)LoadLibrary in the Initialization (=dllMain!) of ComServ. Remember that this call is not safe in initialization/dllMain.

My favorite links about "scary" things in dllmain are:
http://blogs.msdn.com/oleglv/archive/2003/10/24/56141.aspx
http://blogs.gotdotnet.com/cbrumme/archive/2003/08/20/51504.aspx

Chris Bensen said...

We are working on cleaning some of these issues up. The best way to make sure we know about them is to enter bugs into Quality Central.

Post a Comment