.NETGURU
Having trouble with COM+ Object Pool and Windows2003 Server
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.component_services.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Post a new message to this list...

Michael (VIP)
I have a COM+ object that only has 1 method. We have been running this object on Windows2000 Server for a year and it’s been working great. We port this to Windows2003 Server and we start to have issues. The object uses Object Pooling and is called from an ASP file. This is what the code looks like in ASP(3.0 not ASP.NET) to call the COM+ object

Set MyObject = Server.Create(“MyProdID”)
RetVal = MyObject.MyMethod()
Set MyObject = Nothing

Now, this has been working great for over a year on Windows2000 Server and also works on WindowsXP. Now, I’m able to create the object, get the return type but it seems to never put the object back into the pool, so every time I call my object, the activated objects seem to keep going up and never put back into the pool, so if I call the code above 5 times, after all 5 calls have returned, it will still have 5 activated objects. Seems like the only way to destroy the objects is to right click and pick shutdown from the menu. Under Windows2000 Server and WindowsXP, each time I do “Set MyObject = Nothing”, the object would go back into the pool, so after 5 calls and all 5 calls return I would have 0 activated objects. I’ve tried putting the attribute [AutoComplete(true)] by itself and it didn’t work, I’ve tried putting [AutoComplete(true)] with ClassInterface AutoDual and it didn’t work. I also tried [AutoComplete(true)] with ClassInterface AutoDispatch and that didn’t work either. I also have a dispose pattern which calls base.dispose passing disposing and it doesn’t work. I’m not sure what else to try?
I hope someone can help. Here are some of the attributes I have that are important
[assembly: ApplicationActivation(ActivationOption.Server)]
[assembly: ClassInterface(ClassInterfaceType.AutoDispatch)](also tried none and AutoDual)
[AutoComplete(true)] on my method
[InterfaceType(ComInterfaceType.InterfaceIsDual)](also tried InterfaceIsIDispatch) on my interface

[Serializable()]
[GuidAttribute("C9998500-65AD-4bb1-8E98-8B4B52C5ADB7")]
[JustInTimeActivationAttribute(true)]
[ObjectPooling(true, 10, 200)]
[MustRunInClientContext(false)]
[ProgId("MyProdId")]
[EventTrackingEnabled(true)]

And I am inheriting off ServicedComponent as well as my interface
Michael

Reply to this message...
 
    
enrico sabbadin @ infinito
did you override canbepooled ans set it to true ?

"Michael" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
> I have a COM+ object that only has 1 method. We have been running this
object on Windows2000 Server for a year and it's been working great. We
port this to Windows2003 Server and we start to have issues. The object
uses Object Pooling and is called from an ASP file. This is what the code
looks like in ASP(3.0 not ASP.NET) to call the COM+ object
[Original message clipped]

type but it seems to never put the object back into the pool, so every time
I call my object, the activated objects seem to keep going up and never put
back into the pool, so if I call the code above 5 times, after all 5 calls
have returned, it will still have 5 activated objects. Seems like the only
way to destroy the objects is to right click and pick shutdown from the
menu. Under Windows2000 Server and WindowsXP, each time I do "Set MyObject
= Nothing", the object would go back into the pool, so after 5 calls and all
5 calls return I would have 0 activated objects. I've tried putting the
attribute [AutoComplete(true)] by itself and it didn't work, I've tried
putting [AutoComplete(true)] with ClassInterface AutoDual and it didn't
work. I also tried [AutoComplete(true)] with ClassInterface AutoDispatch
and that didn't work either. I also have a dispose pattern which calls
base.dispose passing disposing and it doesn't work. I'm not sure what else
to try?
> I hope someone can help. Here are some of the attributes I have that are
important
[Original message clipped]

Reply to this message...
 
    
Michael (VIP)
Yes, I did this:
protected override bool CanBePooled()
{
return true;
}

I also have done more testing on WindowsXP, which always subtracted the 1 from the activated and objects columns right after the method returns. I went back after these windows2003 issues and put a breakpoint inside the dispose(bool) pattern as well as the public method that gets called. Well, I called the public method from an asp page and it stopped at the breakpoint inside my public method like expected, but my dispose(bool) NEVER got called. So I am wondering if I need to put a finalizer that calls the dispose pattern rather than the base class finalizer call my dispose pattern.
Also something to note I also watched my COM + object from the performance monitor GC counter "finalization survivors" in Windows2003 server. My COM+ object would have about 500 pooled objects activated (which is allot I think), and that number would drop from 500 to 10 every once in awhile, and when it dropped the "finalization survivors" went up the same amout, which makes no sense according to the explanation which is

"This counter displays the number of garbage collected objects that survive a collection because they are waiting to be finalized. If these objects hold references to other objects then those objects also survive but are not counted by this counter; the "Promoted Finalization-Memory from Gen 0" and "Promoted Finalization-Memory from Gen 1" counters represent all the memory that survived due to finalization. This counter is not a cumulative counter; its updated at the end of every GC with count of the survivors during that particular GC only. This counter was designed to indicate the extra overhead that the application might incur because of finalization."

If I understand this correct, the COM+ finalization still has not been called yet, but all the activated objects go from 500 to 10 at the same time finalization survivors counter goes up a great deal. Anyway, maybe someone can help me understand this and also tell me how I can get COM+ to act like this:

Set MyObject = Server.CreateObject("MyProdID") 'add 1 to the activated objects
MyRetVal = MyObject.MyMethod()
Set MyObject = Nothing ' subtract 1 from the activated objects

Thanks
Michael

"enrico sabbadin @ infinito" wrote:

[Original message clipped]

Reply to this message...
 
    
Florin Lazar [MSFT] (VIP)
Hi Michael,

Have you tried calling Dispose on your objects? I'm not familiar with VB so
I might be wrong here.

Set MyObject = Server.CreateObject("MyProdID")
MyRetVal = MyObject.MyMethod()
MyObject.Dispose()

Regards,
--
Florin Lazar - Microsoft - [ http://blogs.msdn.com/florinlazar ]
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.

"Michael" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Jim Hsu
try add code :

ContextUtil.DeactiveOnReturn = true
in your method call....

I had the same experiences, this line of code is not necessary in WinXP, but
somehow it saved my ass in W2K3.

HTH.
if this do the trick, pls let me know, apparently MS has some explanation to
give.. :-)

Jim

"Florin Lazar [MSFT]" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
 
System.EnterpriseServices.ActivationOption
System.EnterpriseServices.ContextUtil
System.EnterpriseServices.JustInTimeActivationAttribute
System.EnterpriseServices.ServicedComponent
System.Runtime.InteropServices.ClassInterfaceType
System.Runtime.InteropServices.ComInterfaceType
System.Runtime.InteropServices.GuidAttribute




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification