473,387 Members | 1,859 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

COM+ object not being released back to the pool

Here's the Scenario I am facing:
I've got a winform managed c++ client which connects to my managed
COM+ server application (by making createinstance, then typecasting
the object to an interface, then calling methods over it). This COM+
server application is from a C# dll that has references to Interop dlls
(com type libraries written in unmanaged c++) and MC++ wrappers over
unmanaged c++ code. I've got object pooling enabled with (Min : 0 and
Max : 1048576). I've got a db connection in the construct() method of
the servicedcomponent.

I am on
1. VS.Net 2003
2. .Net framework 1.1
3. COM+ is a server application with JIT disabled, object pooling
enabled.

Issue:
When I run the winform client for the first time, everything goes well.
But when I close it the object stays there and isn't released back to
the pool. I mean in the component services mmc, event statistics i can
see Objects: 1 Activated: 1 Pooled: 1.

If I invoke my COM+ component from a vbscript, C# client, unmanaged c++
client (by cocreateinstance()) the objects are being returned back to
the pool properly. Point to note here is I don't even call the
ServicedComponent.DisposeObject() at client.
Whereas it doesn't work in my above scenario (winform managed c++)
client even after I do a disposeobject or Marshal.ReleaseComObject().

No matter what, the objects keep on growing as many no of clients
getting connected.

1. How to make them released back to the pool immediately as the client
is closed? or what am I doing wrong here?

Could you please help me out to resolve this issue. I've searched over
the web everywhere, read many of answers to these kind of
questions in newsgroups, tried various options, but I am yet to find a
solution.
Here's a list of options I tried and couldn't succeed.
1. ServicedComponent.DisposeObject(obj); at the client.
2. Called Marshal.ReleaseComObject(interop object) at the client.
Released all com objects.
3. ServicedComponent.DisposeObject(this); at the server, just after
deactivate() and disconnect().
4. Called Marshal.ReleaseComObject(interop object) at the server.
Released all com objects.
5. Deactivate() was not getting called when winform client closes. So
I tried forcibly calling it from server's disconnect method. Didn't
work.
6. Set JIT activation to true in component's properties.
7. Set Object pooling disabled in component's properties.

2. Also one more question, if my object pooling is enabled, and the
construct() method of servicedcomponent is called everytime a request
comes, does it mean object pooling is of no use here? In object
pooling, if a second request comes, isn't it not supposed to invoke
construct() and directly call activate()?

Thanks and Regards,
Vin

Nov 17 '05 #1
2 3290
Vin,

It is interesting that it works for VBScript and unmanaged C++ AND ALSO
for a C# client. If the C# client didn't work, I would say that you have an
issue with not releasing references correctly. However, the C# client
releasing correctly is what gives me pause.

Do you have the AutoComplete attribute on any of the methods which will
cause JIT activation to occur? I recall reading somewhere that this was
required for JIT to function correctly (even though it is primarily
associated with transactions). If you do not, and you apply it, does it
work then?

Also, I am not sure you should be creating the database connection in
the call to Construct. The only scenario where I can see this working is
where you have the database connection created, but not opened in the call
to construct, and in the activate and deactivate calls for JIT, you open and
close the connection respectively. If you open it in the call to Construct,
I think you will have some problems.

Now, in your managed C++ code, you say you are calling CreateInstance (I
assume you mean CoCreateInstance here). Why not use the managed
representation of the class (like you do in the C# client)? The CLR will
wire up everything for you, and you will probably get the behavior that you
want.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"VinDotNet" <av******@gmail.com> wrote in message
news:11*********************@g43g2000cwa.googlegro ups.com...
Here's the Scenario I am facing:
I've got a winform managed c++ client which connects to my managed
COM+ server application (by making createinstance, then typecasting
the object to an interface, then calling methods over it). This COM+
server application is from a C# dll that has references to Interop dlls
(com type libraries written in unmanaged c++) and MC++ wrappers over
unmanaged c++ code. I've got object pooling enabled with (Min : 0 and
Max : 1048576). I've got a db connection in the construct() method of
the servicedcomponent.

I am on
1. VS.Net 2003
2. .Net framework 1.1
3. COM+ is a server application with JIT disabled, object pooling
enabled.

Issue:
When I run the winform client for the first time, everything goes well.
But when I close it the object stays there and isn't released back to
the pool. I mean in the component services mmc, event statistics i can
see Objects: 1 Activated: 1 Pooled: 1.

If I invoke my COM+ component from a vbscript, C# client, unmanaged c++
client (by cocreateinstance()) the objects are being returned back to
the pool properly. Point to note here is I don't even call the
ServicedComponent.DisposeObject() at client.
Whereas it doesn't work in my above scenario (winform managed c++)
client even after I do a disposeobject or Marshal.ReleaseComObject().

No matter what, the objects keep on growing as many no of clients
getting connected.

1. How to make them released back to the pool immediately as the client
is closed? or what am I doing wrong here?

Could you please help me out to resolve this issue. I've searched over
the web everywhere, read many of answers to these kind of
questions in newsgroups, tried various options, but I am yet to find a
solution.
Here's a list of options I tried and couldn't succeed.
1. ServicedComponent.DisposeObject(obj); at the client.
2. Called Marshal.ReleaseComObject(interop object) at the client.
Released all com objects.
3. ServicedComponent.DisposeObject(this); at the server, just after
deactivate() and disconnect().
4. Called Marshal.ReleaseComObject(interop object) at the server.
Released all com objects.
5. Deactivate() was not getting called when winform client closes. So
I tried forcibly calling it from server's disconnect method. Didn't
work.
6. Set JIT activation to true in component's properties.
7. Set Object pooling disabled in component's properties.

2. Also one more question, if my object pooling is enabled, and the
construct() method of servicedcomponent is called everytime a request
comes, does it mean object pooling is of no use here? In object
pooling, if a second request comes, isn't it not supposed to invoke
construct() and directly call activate()?

Thanks and Regards,
Vin

Nov 17 '05 #2

"VinDotNet" <av******@gmail.com> wrote in message
news:11*********************@g43g2000cwa.googlegro ups.com...
Here's the Scenario I am facing:
I've got a winform managed c++ client which connects to my managed
COM+ server application (by making createinstance, then typecasting
the object to an interface, then calling methods over it). This COM+
server application is from a C# dll that has references to Interop dlls
(com type libraries written in unmanaged c++) and MC++ wrappers over
unmanaged c++ code. I've got object pooling enabled with (Min : 0 and
Max : 1048576). I've got a db connection in the construct() method of
the servicedcomponent.

I am on
1. VS.Net 2003
2. .Net framework 1.1
3. COM+ is a server application with JIT disabled, object pooling
enabled.

Issue:
When I run the winform client for the first time, everything goes well.
But when I close it the object stays there and isn't released back to
the pool. I mean in the component services mmc, event statistics i can
see Objects: 1 Activated: 1 Pooled: 1.

If I invoke my COM+ component from a vbscript, C# client, unmanaged c++
client (by cocreateinstance()) the objects are being returned back to
the pool properly. Point to note here is I don't even call the
ServicedComponent.DisposeObject() at client.
Whereas it doesn't work in my above scenario (winform managed c++)
client even after I do a disposeobject or Marshal.ReleaseComObject().

No matter what, the objects keep on growing as many no of clients
getting connected.

1. How to make them released back to the pool immediately as the client
is closed? or what am I doing wrong here?

Could you please help me out to resolve this issue. I've searched over
the web everywhere, read many of answers to these kind of
questions in newsgroups, tried various options, but I am yet to find a
solution.
Here's a list of options I tried and couldn't succeed.
1. ServicedComponent.DisposeObject(obj); at the client.
2. Called Marshal.ReleaseComObject(interop object) at the client.
Released all com objects.
3. ServicedComponent.DisposeObject(this); at the server, just after
deactivate() and disconnect().
4. Called Marshal.ReleaseComObject(interop object) at the server.
Released all com objects.
5. Deactivate() was not getting called when winform client closes. So
I tried forcibly calling it from server's disconnect method. Didn't
work.
6. Set JIT activation to true in component's properties.
7. Set Object pooling disabled in component's properties.

2. Also one more question, if my object pooling is enabled, and the
construct() method of servicedcomponent is called everytime a request
comes, does it mean object pooling is of no use here? In object
pooling, if a second request comes, isn't it not supposed to invoke
construct() and directly call activate()?

Thanks and Regards,
Vin


ServicedComponent.DisposeObject(yourobj);
should definitely work.
Mind to post your code or at least a repro case?

To answer your second question, Contruct should only be called when
constructing a new object, it should not be called if there are objects
available from the pool, are you sure you return true from your CanBePooled
method?

Willy.
Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: pigwin32 | last post by:
I have an asp application that uses a javascript server side include to instantiate a component for generating our menu html. The component is pooled and worked perfectly on Windows 2000. On...
2
by: VinDotNet | last post by:
Here's the Scenario I am facing: I've got a winform managed c++ client which connects to my managed COM+ server application (by making createinstance, then typecasting the object to an interface,...
5
by: david.kao | last post by:
Hi All: I am creating a COM+ Pool object in C#. I set up the following attributes: JIT (true),Pool size; and at the end of each public method I called ContextUtil.DeactivateOnReturn=true to set...
2
by: Steve Peterson | last post by:
Hi I have an application that is designed for multi clients, therefore users must go through a login page. Upon logging in I set some properties in a class, one of which is the user id (integer)...
5
by: Tim Frawley | last post by:
I created a .NET Com Class object for use in ASP reports to export database results directly to Excel. I have it all working just find but I cannot get the Excel process to go away after the job...
5
by: Michael Moreno | last post by:
Hello, In a class I have this code: public object Obj; If Obj is a COM object I would like to call in the Dispose() method the following code: ...
13
by: Vijay | last post by:
Hi All, I am learning C++ and have one question. Using free or delete we can release the memory. After releasing memory where this released memory will go.. Does it go to back operating...
7
by: Remote_User | last post by:
Hi All, I have my ASP.NET application hosted in COM+ and I have my client app. Is there any way I can limit the number os sessions? Say, I have 5 client requests and they instantiate 5 COM+...
1
by: =?Utf-8?B?VmVua2F0ZXNhbiBT?= | last post by:
Hi, I have a requirement of consuming a connection object returned from a COM component deployed in COM+ application. I have given the need for this requirement end of my query. My component...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.