OutOfMemoryException on IIS 5.0 with .net framework 1.1.4322, please advice

We are haveing more and more OutOfMeomoryException these days, at first, it happened once a week, now three times a week. The worst thing is, IIS didn't recycle its aspnet_wp.exe thread when this exception was thrown. And every one tried to connect IIS server now saw this error.

Our configuration is as follow,
Windows server 2000,
2 Xeon CPU
2GB memory
3.7GB free space on system drive, and much more on other drives
IIS 5.0 with net framework v1.0.3705 and v1.1.4322.573 installed
All the web applications are configurated to run with .net framework v1.1.4322.573

Average daily page views is about 100,000, all the isolation level are set to medium.

MemoryLimit in all web.config files are set to default value at 60 percent. The consumed memory of aspnet_wp.exe was at only 600MB as the OutOfMemoryException happened, much lower than 2GB*605 = 1.2GB.  I read quite a few threads on line, some said that the MemoryLimit of .net framework 1.0 should be set to no more than 800MB if not with /3GB switched on. But I found no article to confirm whether this also  appliest to .net framework 1.1. Could anyone explain it for me?

I also recognized that Microsoft admiitted there is a bug in .net framework 1.1 which would report OutOfMemoryException when there is pretty much memory available, the hot fix was bundled in .net framework 1.1 SP1. However, in my situation because it is a production system used by hundreds of people, we dare not to apply such a big change without concrete evidence.

My question is what should I do, I mean to change the IIS settings, or settings in web.config files, to minimize impact of this OutOtMemoryExceptions? I guess it would also be acceptable, if IIS recycle its aspnet_wp.exe thread when it goes out of memory rather than refuse any more connection.

Any advice is appreciated.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

IIS has no control over the ASP.Net worker process - it is a seperate process.

If you are running into the problem described in the hotfix you should all Microsoft and get the hotfix.  If you are calling to get a hotfix there is no charge for the call.

Dave Dietz
Is your code trying to access a COM component?
Alternatively try explicitly closing and disposing any open connections after you are done with the processing.

Hope this helps.
toStringAuthor Commented:
Thanks for both your advices.

As far as I know, we have no web application accessing any COM component.

But I do have a suspicious culprit, we transfer report source to Crystal Report Viewer objects via  session variables. A single object might taken 3-5 MBs of memory, I guess this is a really bad practice but I can't prove it is the root cause.

I don't have to call MS to have the hot fix, it is budled into .net framework SP1 for free. My concern is they fixed many problems in this service pack, we can't apply the service pack before it is fully tested with our applications.
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

Do you explicitly close and dispose Crystal report viewer object?

We had faced a similar problem with Crystal report object and there the solution suggested by Microsoft was to explicity close and dispose the objects.
This has certainly reduced the number of occurances of the problems.
There is a known memory leak problem with Crystal Reports and .NET.

Do you use SETDATASOURCE method anywhere in your code?

toStringAuthor Commented:
No, we do not explicitly close/dispose Crystal Report viewer object.

Actually, we have a common page which holds a CR viewer object as below,
   <form id="Form1" method="post" runat="server">
      <CR:CRYSTALREPORTVIEWER id="CrystalReportViewer1" style="Z-INDEX: 101; LEFT: 1px;
         POSITION: absolute; TOP: 2px" runat="server" Width="350px" Height="50px"
         DisplayGroupTree="False" HasSearchButton="False" EnableDrillDown="False"
         HasDrillUpButton="False" HasToggleGroupTreeButton="False"

Then in code behind,
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _
      Handles MyBase.Load
            objReport = Session("Report")
            With CrystalReportViewer1
                .ReportSource = objReport.crReport
            End With
        Catch ex As Exception
            'error handling code here
        End Try
    End Sub

Here objReport is a customized class that has following members,
    Public Class crReport
        Private ParaFieldDefs As ParameterFieldDefinitions
        Private Report As New ReportDocument()
        Private Connection As New ConnectionInfo()
        Private Parameters As New ReportParameters()
        Private TemplateFile As String
    End Class

By the way, I found no "close" but only "dispose" method for crystal report viewer objects. Am I overlooking sometihng? And is it reasonable to dispose this object when placed on a web page?

Thanks for your input in advance!
Inside class crReport, we have a ReportDocument object.
Could you try both closing and disposing the objects in crReport class?

Notes from MSDN:
Call Dispose when you are finished using the CrystalReportViewer. The Dispose method leaves the CrystalReportViewer in an unusable state. After calling Dispose, you must release all references to the CrystalReportViewer so the memory it was occupying can be reclaimed by garbage collection.

Note   Always call Dispose before you release your last reference to the CrystalReportViewer. Otherwise, the resources that the CrystalReportViewer is using will not be freed until garbage collection calls the CrystalReportViewer object's destructor.

toStringAuthor Commented:
Thanks deeptinayak, I'll try and monitor how it goes on, for a few more days.
toStringAuthor Commented:
According to my examination, closing and disposing Crystal Report has no immediate effect to allocated memory of aspnet_wp.exe, how long should I wait, or is there any other indicator can tell me there are more memory ready to be reclaimed by GC?
Have you considered getting the hotfix (as opposed tothe whole SP1 package) yet?

Dave Dietz
toStringAuthor Commented:
Microsoft doesn't provide standalone hotfix for the mentioned OutOfMemory bug, has to install the whole 1.1. SP1 package.
One more go:
Try taking the memory dump at the time of the problem and there are tools available at www.microsoft.com to analyse the memory dumps. The analysis will tell you the number of processes active at that time and the memory consumption etc.

Do you have Microsoft support for your project?
If yes, you can ask them to analyse the same for you.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
toStringAuthor Commented:
We have Microsoft support for global projects but unfortunately, this one is a local project.

As for memory dump, that's exactly what I am going to do, I am reading the Microsoft book on production environment debugging, not quite understand the material yet.

Thanks for your commments, deeptinayak.
toStringAuthor Commented:
Later on I found, based on performance counters and IIS logs, certain pages returned
tens of thousands of records without pagination. This could easily lead the IIS server
into OutOfMemoryException status.

But I don't know why it doesn't trigger OutOfMemoryException when data gathered as below,

.Net CLR Memory
   # Total commited Bytes 499,940,944
   # Total reserverd Bytes 603,979,344

Process aspnet_wp
   Virtual Bytes 1,089,425,408

Sum up these three is about 2.04GB which already exceeds virutal address limit of process, that is, 2.0GB.

But IIS worked on for 30 more minutes that day.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft IIS Web Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.