Groups | Blog | Home
all groups > inetserver asp components > november 2004 >

inetserver asp components : COM+ Application will not shut down after idle shutdown time


tony.goncalves NO[at]SPAM mckesson.com
11/11/2004 7:34:51 AM
I am running IIS 5.0 with COM+, and have run into 'Out of memory'
errors in calls to components in one of the COM+ applications. It was
discovered that the COM+ application is not shutting down, which
allowed the processes memory to keep growing. I know this because the
PID never changed while monitoring over several days. The idle timeout
was set at 3 minutes, while it was being monitored, and I have set it
as low as 1 minute in other tests, without any affect.

- The Web application is running as a Low (IIS Process).
- The COM+ application is a server application.

I also monitored the COM+ application using process explorer from
sysinternals, and found that the issue was related to whether the dlls
in the application were memory-mapped, after being loaded. When the
components were instantiated, for the first time, from an ASP page,
using Server.CreateObject(), the dll would always be memory mapped,
and the application would never shut down, regardless of the idle
timeout setting. I could eliminate the memory-mapping by forcing the
application to shut down, using Component Services. Every time it was
memory-mapped, it would not shutdown by itself. If it was not
memory-mapped it would shut down.

I also found that the memory-mapping that prevented the application
from shutting down only occured when the components were instantiated
using Server.CreateObject(). I could eliminate the memory-mapping by
using just CreateObject().

So I have some facts about what is happening, but I am not sure about
the solution. I will look into the ramifications of switching from
Server.CreatObject() to CreatObject(), but I was hoping someone would
recognize this issue, and provide some tips on how to prevent the
memory-mapping.

tony.goncalves NO[at]SPAM mckesson.com
11/12/2004 11:21:19 AM
They are not shutting down because there is an IIS metabase property
named 'AspEnableTypelibCache' that needs to be set to false, before
the COM+ idle timeout will have any affect. Details in these
articles:

Shutting down COM+ application at timeout:
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q255912&ID=KB;EN-US;Q255912

AspEnableTypelibCache
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iissdk/iis/ref_mb_aspenabletypelibcache.asp

You can get and set this property by using one of the admin scripts
that are installed with IIS:

cscript C:\Inetpub\AdminScripts\adsutil.vbs get
w3svc/aspEnableTypelibCache
cscript C:\Inetpub\AdminScripts\adsutil.vbs set
w3svc/aspEnableTypelibCache false

Or you can use the ADSI objects:

Dim oNode
Dim sNodePath

sNodePath = "IIS://LocalHost/w3svc"
Set oNode = GetObject(sNodePath)
If Err.number <> 0 Then
WScript.Echo "Error getting IIS node object: " & sNodePath
End If

oNode.AspEnableTypelibCache = False
oNode.SetInfo
Set oNode = Nothing

Our Web Applications are set to run in Low (IIS Process), this means
that we had to set the property at the "IIS://LocalHost/w3svc" node of
the metabase path. The property exists at lower levels, for instance
"IIS://LocalHost/w3svc/1/MyVirDir", but it doesn't affect the Web
Application, unless it is set to run in High (Isolated) mode.

Turning off the ASP Typelib Cacheing, eliminated the memory-mapping,
AddThis Social Bookmark Button