Link to home
Start Free TrialLog in
Avatar of domenic
domenic

asked on

inetinfo.exe leak?

Setting: Windows 2000, IIS 5.0, ASP pages interacting with MS Access databases. Multiple (duplicate) applications written in MS VC++ populating the databases with remote data. These applications also call a third party COM object that sends data to a remote server. In all we have 20 directories containg 20 apps and the corressponding asp pages under the default web site.

Symptom: As the day progresses inetinfo.exe mem usage keeps growing as per Task Manager Is this normal behavior? Does it grow indefintely?. We have loaded the latest SP from Microsoft. I think memory becomes an issue because strange occurrences are witnessed. One occurrence includes the inability to resolve remote IP addresses, for example, the 3rd party COM object fails to connect to the remote server, Internet Explorer can't find common web sites, etc. On the other hand, the web pages remain accessible. Stop/start IIS (including inetinfo.exe) resolves the problem.

Where should I focus to determine the problem area (ASP pages, the applications themselves, IIS configuration)? Please advise.

Avatar of enkay022798
enkay022798

How about the CPU usage by inetinfo ? Does that show more than 0 even though there is no activity going on or is it only the memory that goes up ?
Avatar of Paul Maker
this should not happern, no scalable server should consume memory without giving it back. eventually when all the page file is used up the machine will start complaining that its running low on virtual memory. i think your first port of call should be your 3rd party component. i can not see it being a problem with your 2000-IIS-MDB thing, unless of course the installation went wrong, maybe reinstall every thing if it persists
It may be a problem with the code, such as recordset not being closed properly, etc etc. Eventually you will eat up all the system resources if you do not close all your db connections properly.
Avatar of domenic

ASKER

Thank you for the quick replies.
Enkay, CPU usage fluctuates for inetinfo since there is always activity during the day.

Makerp, I have contacted the third party concerning a leak with their COM object and they have no reported problems from other users. What part of the installation would I need to re-do?

Liebrand,
Doesn't ASP close the db connection automatically once you leave the page? Is there a way to detect current outstanding connections?
Avatar of domenic

ASKER

Thank you for the quick replies.
Enkay, CPU usage fluctuates for inetinfo since there is always activity during the day.

Makerp, I have contacted the third party concerning a leak with their COM object and they have no reported problems from other users. What part of the installation would I need to re-do?

Liebrand,
Doesn't ASP close the db connection automatically once you leave the page? Is there a way to detect current outstanding connections?
Avatar of domenic

ASKER

Thank you for the quick replies.
Enkay, CPU usage fluctuates for inetinfo since there is always activity during the day.

Makerp, I have contacted the third party concerning a leak with their COM object and they have no reported problems from other users. What part of the installation would I need to re-do?

Liebrand,
Doesn't ASP close the db connection automatically once you leave the page? Is there a way to detect current outstanding connections?
Avatar of domenic

ASKER

Thank you for the quick replies.
Enkay, CPU usage fluctuates for inetinfo since there is always activity during the day.

Makerp, I have contacted the third party concerning a leak with their COM object and they have no reported problems from other users. What part of the installation would I need to re-do?

Liebrand,
Doesn't ASP close the db connection automatically once you leave the page? Is there a way to detect current outstanding connections?
Avatar of domenic

ASKER

Thank you for the quick replies.
Enkay, CPU usage fluctuates for inetinfo since there is always activity during the day.

Makerp, I have contacted the third party concerning a leak with their COM object and they have no reported problems from other users. What part of the installation would I need to re-do?

Liebrand,
Doesn't ASP close the db connection automatically once you leave the page? Is there a way to detect current outstanding connections?
Avatar of domenic

ASKER

Thank you for the quick replies.
Enkay, CPU usage fluctuates for inetinfo since there is always activity during the day.

Makerp, I have contacted the third party concerning a leak with their COM object and they have no reported problems from other users. What part of the installation would I need to re-do?

Liebrand,
Doesn't ASP close the db connection automatically once you leave the page? Is there a way to detect current outstanding connections?
em received load and clear :), if i missed the first post i was sure to catch the comment anyway :)

in my experience these problems are always down to dodgy installation, i would re-do the lot, windows up. the thing is people say user code but IIS should free resources when a script finsihes regardless of what the script never freed itself,

 
Avatar of domenic

ASKER

(I apologize for the multiple postings but I don't think I was responsible. EE hiccup?)
I agree with makerp. IIS uses garbage collector (clear memory) when page finishes or variable code scope is finished (function internal variables frees when function finishes etc.) but it is better to close all recordsets and set them to nothing in your code. It is good programming style. Your code will be "symmetric": create object - use it - delete object.
Other point - third party components memory leaks. You can test components you uses. Create special page where you will create, work with component and release it, execute it in a separated thread and test this page. You can use special tools, e.g. MS web stress application but can use only your web browser.
Don't think that if nobody have reported problem to developers of COM component it doesn't mean that there is no such problem. I used one well-known library which has such bug (memory leak) but nobody told about it to developer of library. I fixed it myself because I had source code.
Create simple page and test it. If you really find bug and send report to developer with detailed description and source of your test files they possible fix it.

Best regards.
It's all because of a bug in IIS4 and 5 obviously, this is the reason why session on end never fires or fires randomly in cases, it's called the Session_OnEnd bug although its directly related to random session timout read what you should do to avoid its side effects:

1-don't do any actions in the session on end since it never gets fired.. in most cases thus it will not be reliable
2- Don't EVER NEVER..EVER (I'll say it once more NEVEEEeeeR) store connections, large arrays, objects in session variables.. span a connection outside the boubdaries of a page..
3-and the most important: DON'T LEAVE A CONNECTION OPEN!! close all connections and clean them : Conn.close:Set Conn = nothing.. deinitialise also ALL created objects in scripts and components,  Set ObjName= nothing to free memory resources..

The problem is when you don't do one of the last 2 points.. the server resources are exauhsted (memory) and it crashes on a timely basis.. since the session data stays loaded in the memory..
(this bug was also detected in IIS5 but is a lot less frequent/ I'll say rare)  <-- you are one of these cases
Avatar of domenic

ASKER

I have taken the task of cleaning up my ASP pages. I was somewhat liberal with not closing my db connection, but I have included a "Conn.close Set Conn=nothing" at the end of every page. I performed some controlled tests on these new pages with the intention of collecting the private bytes used by inetinfo.exe using perfmon. I compared the results between the ASP pages with/without the changes. Inetinfo actually used more private bytes with my new ASP pages. There goes that. Nonetheless as kmv stated I will include these changes on the production machine because it is just 'good programming style'.

A Microsoft techie also suggested I free up my Session variables. I'm not quite sure if and how that would help. I use a Session variable as temporary data storage for a function call. I use the Session variables in one page only and then they are just disregarded. If I need the information again I recall the function to have them re-assigned.  Is this wasting memory significantly? I have noticed that the Session variables do expire quite rapidly and I did not expect that I needed to delete them somehow. Please comment on this.

The latest outcome happened this weekend. Activity on the web server is almost nil, but the problem occurred again while we were browsing around. The problem in question (as described in the first post) is that IP addresses are not resolved. Memory, it seemed, or lack of was not to blame. A call to Microsoft pointed us towards a new direction - MDAC. Apparently, there is several conflicting issues when we ran the Component Checker. Hence, tonight the MDAC 2.6 will be re-installed (you said it, makerp ;-)) and I will continue to monitor the situation.
Session("NameOfVar") = ""  session objects should be deinitialised to free up memory resources.. I don't agree that when a script finishes it empties all the objects , session objects are there and won't unload because of the stated bug.. MDAC is the connection issue.. if you are closing your connection objects and cleaning them all should be fine on this side.. check what asp faq has to say about that:

http://www.aspfaq.com/faq/faqShow.asp?fid=66

http://www.aspfaq.com/faq/faqShow.asp?fid=7
Avatar of domenic

ASKER

Silvers5,

Thank you for the input. I do not use Session_onend in my global.asa. Furthermore, I have never seen any ASP code that performs this type of de-initialization where you set

Session( "my_var") = ""

Does this release the memory?
yes.. especially if you are storin arrays.. the session timeout fires randomly.. and sometimes never fires.. this is directly "noticed" in the Session on end.. you may not be using it.. but your session is not timing out.. so the objects remains loaded in memory..

rgrds
Avatar of domenic

ASKER

Despite several tests, ASP modifications, and some dead-end recommendations from Microsoft (which caused further IIS crashes), I was able to duplicate (somewhat) the inetinfo.exe problem on my test machine which is set up identical to our production machine. After reviewing the IIS logs I did notice some consistency right before the problem arises. I do have some seldom used feature in an ASP page that uses a wrapper DLL written in VB6 (borrowed from Microsoft's KB) to the Internet Transfer Control class. This ASP code returns data from a web site using OpenUrl (HTTP), strips the HTML tags, and displays it on the client browser. It returns successfully every time, however, I've had it where it unexpectedly causes inetinfo.exe to become CPU bound and IIS no longer responds to http requests. Perusing the Microsoft support site I did come across some article denoting a bug with Inet.OpenUrl and FTP requests and how it causes inetinfo.exe to become CPU bound. They do suggest a workaround but I'm wondering if this explains the problem I was able to duplicate. The article seems to indicate that the problem is consistent in nature, unlike what I experience. Nonetheless I have disabled the feature and continue to monitor. I've read every article available in MS KB on the subject of ITC. What does experience dictate for the use of ITC in ASP?
Hmm... Microsoft is unpredictable.. try to use other ways:

How do I read the contents of a remote web page?    
You can include static txt and HTML files from remote servers by using a component (such as AspHTTP (http://www.serverobjects.com/products.htm), ASPTear (http://www.alphasierrapapa.com/ComponentCenter/AspTear/), or VB's built in InetCtrls) to parse the remote URL's content.
 
You can also try this method out, it uses the MSXML objects which are installed with Windows 2000 (or you can download them here (http://download.microsoft.com/download/xml/Install/3.0/WIN98Me/EN-US/msxml3.exe) for other operating systems):
 
<%
    url = "http://www.espn.com/
    set xmlhttp = server.CreateObject("Microsoft.XMLHTTP")
    xmlhttp.open "GET", url, false
    xmlhttp.send "" 
    Response.write xmlhttp.responseText
%>

but you'll still need to clean the tags..

ASKER CERTIFIED SOLUTION
Avatar of Michel Sakr
Michel Sakr
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of domenic

ASKER

Thank you for all the input. Summary: As of today the original problem still exists ( ...One occurrence includes the inability to resolve remote IP addresses, for example, the 3rd party COM object fails to connect to the remote server, Internet Explorer can't find common web sites, etc. ...) but the smoke has cleared so a better understanding of the problem has come about. It seems that the 3rd party COM object may be the culprit (not officially yet) and our focus has shifted toward dealing with the potential weakness of the COM object.
Avatar of domenic

ASKER

Thank you for all the input. Summary: As of today the original problem still exists ( ...One occurrence includes the inability to resolve remote IP addresses, for example, the 3rd party COM object fails to connect to the remote server, Internet Explorer can't find common web sites, etc. ...) but the smoke has cleared so a better understanding of the problem has come about. It seems that the 3rd party COM object may be the culprit (not officially yet) and our focus has shifted toward dealing with the potential weakness of the COM object.