ASP.NET application hits 2GB virtual bytes

G

Guest

We have a problem with a ASP.NET web application that is experiencing
OutOfMemory Exceptions. On analysis we have noticed that the Virtual Bytes
of the aspnet_web process ( running IIS5 Mode on Win2K3 ) hits the 2GB mark.

The server it is being tested on has 4GB of RAM, with the 3GB switch on boot.

We have also added the following to the machine.config

<processModel enabled="true" memoryLimit="20" ... />

According to the documentation this should have limited the virtual bytes to
approx 800 MB for the process.

Can anyone shed any light on this, or suggest other measurements / settings
we should be looking at ?

Cheers...

Rob
 
E

Eliyahu Goldin

Don't know much about the memoryLimit setting. Just wanted to share a
general idea that one of the most common sources for memory problems is
InProc state management. If you use it and keep a lot of data in session
variables, you may consider taking session out of the asp.net working
process and use one of OutProc methods.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
 
G

Guest

Session Management is SQL Server

Eliyahu Goldin said:
Don't know much about the memoryLimit setting. Just wanted to share a
general idea that one of the most common sources for memory problems is
InProc state management. If you use it and keep a lot of data in session
variables, you may consider taking session out of the asp.net working
process and use one of OutProc methods.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


Robert Slaney said:
We have a problem with a ASP.NET web application that is experiencing
OutOfMemory Exceptions. On analysis we have noticed that the Virtual
Bytes
of the aspnet_web process ( running IIS5 Mode on Win2K3 ) hits the 2GB
mark.

The server it is being tested on has 4GB of RAM, with the 3GB switch on
boot.

We have also added the following to the machine.config

<processModel enabled="true" memoryLimit="20" ... />

According to the documentation this should have limited the virtual bytes
to
approx 800 MB for the process.

Can anyone shed any light on this, or suggest other measurements /
settings
we should be looking at ?

Cheers...

Rob
 
J

Juan T. Llibre

Hi, Robert.

re:
!> The server it is being tested on has 4GB of RAM, with the 3GB switch on boot.

The 3GB switch limits the *virtual address space*, not the working memory set.

re:
!> <processModel enabled="true" memoryLimit="20" ... />
!> According to the documentation this should have
!> limited the virtual bytes to approx 800 MB for the process

Since, if you use the 3GB switch, you have 3GB for user mode virtual address space
and 1GB of kernel mode virtual address space, and kernel mode virtual address space
is not available to applications, you should be seeing physical RAM top out at 600MB
( 20% of the available 3GB user mode address space ) ...and your application recycling at that point.

20% is way too little for IIS and ASP.NET to function efficiently.
Try setting that to at least 40-50%. The default is 60%.

You need to distinguish between memory usage and virtual address space.

The term "address space" refers to how a numerical value (known as an "address")
is interpreted when it is used to access some type of resource.

There is a physical address space; each address in the physical
address space refers to a byte in a memory chip somewhere.

The virtual address space is the set of possible pointer values
(addresses) that can be used at a single moment by the processor.

If you have an address like 0x12345678, the virtual address space
determines what you get if you try to access that memory.

The contents of the virtual address space changes over time, as you allocate and free memory.
It also varies based on context: each process has its own virtual address space.

Saying that 2GB or 3GB of virtual address space is available to user mode means that at
any given moment in time, out of the 4 billion virtual addresses available in a 32-bit value,
2 billion (or 3 billion) of them are potentially usable by user-mode code.

What I would suggest is taking a look at your code and seeing which
processes are causing the extremely large usage of virtual memory.

Maybe Process Explorer could give you an inkling as to which processes are hogging your memory.
Download it from : http://www.microsoft.com/technet/sysinternals/utilities/processexplorer.mspx

The processes' images will have some info for you.

That said, your basic problem is that you're running in IIS 5.0 compatibility mode.

When a server is running in IIS 5.0 isolation mode, application pools,
***recycling***, and health monitoring features are unavailable.

That makes debugging memory processes a tad more difficult,
and that recycling is not available is the reason why you are seeing RAM use run to 2GB.

Is there any reason you're running IIS 5 isolation mode ?

Can you switch to IIS 6.0's worker process isolation mode ?

If you can do that ( IIS 5.0 compatibility is not too-often needed ),
you'll be able to use recycling...and your IIS processes will keep themselves healthy.
 
G

Guest

Hi Juan,

Thanks for the detailed reply.

We found the problem last night, we essentially had a resource/memory leak.

We use the MS Enterprise Library for some logging and we had a invalid
assembly reference (in config) for a LogSink. The Configuration block loads
up a FileWatcher on a background thread ( looking for changes to web.config )
before attempting to load the LogSink for the first time. As the assembly
reference was incorrect, the Reflection call failed but the watcher thread
was not cleaned up.

When the assembly reference was corrected, the issue disappeared.

.... so there is a bug in the June 2005 drop of the MS Enterprise Library
that manifests itself if a bad config is used.

The aspnet_wp process itself never used more than 300 MB of RAM during this
entire scenario so the limit was never reached for recycle.

For those that are interested, we found the culprit of the leak using the
ANTS Profiler tool.

Cheers...

Rob
 
W

Walter Wang [MSFT]

Hi Rober,

Welcome to MSDN Managed Newsgroup and thanks for sharing the information
with the community.

I'm interested to know the details about the issue that you've found in the
Enterprise Library June 2005 version. I'm sure such information will be
invaluable for us to improve our products. You can email me the detailed
information so that I can report to our product team. Thanks for the effort.


Sincerely,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
For MSDN subscribers whose posts are left unanswered, please check this
document: http://blogs.msdn.com/msdnts/pages/postingAlias.aspx

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express/Windows Mail, please make sure
you clear the check box "Tools/Options/Read: Get 300 headers at a time" to
see your reply promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
J

Juan T. Llibre

re:
!> we essentially had a resource/memory leak

It certainly looked that way to me.

re:
!> the Reflection call failed but the watcher thread was not cleaned up

Interesting! Thanks for the info/update.

re:
!> For those that are interested, we found the culprit of the leak using the ANTS Profiler tool.

And a great tool it is!

If you read this, please send a summary of the problem/resolution to Walter Wang.

He posted that request in a reply to this thread and wants to see if the
Enterprise Library can be improved so that type of problem can be prevented.

Thanks...and congratulations on the resolution!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,828
Latest member
LauraCastr

Latest Threads

Top