Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

COM + objects are not being destroyed in Win 2003

Status
Not open for further replies.

memdiscount

Programmer
Mar 12, 2008
50
US
Problem:

Recently, we found the issue of Dot Net COM+ components not destroyed properly.

Symptom

Objects got created but not destroyed after use. Object = Nothing is not destroying the object in some scenarios. This could lead to the hanging of the component or the server and a reboot may be required to recover.

What works and what doesn’t

Following Works:

# Client (Caller) COM + Operating System (COM + Version)
1 VB6 VB6 Windows 2000 (1.0)
2 VB6 VB6 Windows 2003 (1.5)
3 VB6 .Net Windows 2000 (1.0)
4 .Net VB6 Windows 2000 (1.0)
5 .Net VB6 Windows 2003 (1.5)

Following does not work:

# Client (Caller) COM + Operating System (COM + Version)
1 VB6 .NET Windows 2003 (1.5)
2 .NET .NET Windows 2003 (1.5)
3 .NET .NET Windows 2000 (1.0)

(Client is the caller of the COM+)

Solution:

For the Case # 1: The solution which has been found and worked is as follows:

(1) For each public method in the class, set
ContextUtil.DeactivateOnReturn = true;

(2) Override the Dispose method in the class:
protected override void Dispose(bool disposing)
{
ServicedComponent.DisposeObject(this);
}

We still need solution for Case 2 and 3.

Problem with Solution:

We have 100s of component which may have thousands of methods, it sounds like tedious to change all the components and all the methods.

Question:

Is there any other solution which can save us to do that tedious task, may be there is some fix available by Microsoft or any better solution?

Thanks
Essa Mughal


 

Try this:

System.Runtime.InteropServices.Marshal.ReleaseComObject(<ComObjectName>)

Note: replace <ComObjectName> with the name of the com object in your code.


I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Hi;

Thanks for the reply,

Where and how I am supposed to add this line.

Thanks
Essa Mughal

 

Use it right before Object = Nothing.

System.Runtime.InteropServices.Marshal.ReleaseComObject(Object)

Object = Nothing

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Thanks, Actually, it means in this solution we are supposed to change all the methods in each components, which is similar to the same solution which I mentioned in my post.

I am looking for some fix which will aviod that changes in components we have more than 100 components which may have more than thousands functions.

Thanks
Essa

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top