473,406 Members | 2,745 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,406 software developers and data experts.

Help Debugging Memory Issues

Hello,
I have been trying to solve a mysterious memory leak problem and was
hoping that you could help me out on my stuck point.
First a bit of background. We have two app servers in an app center
cluster that are each running a number of web applications. For some
reason one of the boxes' asp_wp process keeps recylcing on us. It seems
that the memory just grows and grows and then recycles on us.
I cam across and have read the Production Debugging for .NET Framework
Applications and found some very good information in trying figure out
where to start looking.

There was a discussion regarding looking at the difference between the
..NET # Bytes in all Heaps and the "Total Private Bytes" of the asp_wp
process. It said that if the total private bytes is growing faster than
the #Bytes in all heaps that it may be native code memory problem.

Current readings show the aspwp process in the task mgr as using 396
mb memory. The toal heap bytes shows only 72 Mb while the Private bytes
is reading 705 Mb. All numbers are stagnate at this point. My question
is:
How is it possible that the total private bytes add up to more than
what is being reported by the task manager. Is this something that I
should be looking at or should I really track memory growth from the
beginning of a clean reset.

Now also I am interested in using the Dump tool to catch when the
process recycles. If I run this script, what do I need to know if I
want to run this from a remote location. Can I use terminal services?
I seem to remember reading something about this but can not find it.
Also if I use the tool, what type of impact does it have on performance
when it is running waiting for the crash to occur?

One of the last questions I have regarding the allocation profiler is
similar to the one about the dump tool. If I have the tool running on a
production server what type of impact does it have on the performance of
the site. Will the performance be hurt so much that users will have an
adverse experience? I understand it is a necessary step, but I just
need to know how evil it is.

Thanks for any further elaboration on the great suite of tools and
documentation that you have created.

Rich

PS - is this the best group for this discussion?

Nov 18 '05 #1
7 2415
Hello Rich,

Thanks for posting. I would try to answer some of your questions.

- How is it possible that the total private bytes add up to more than what
is being reported by the task manager.

In Task Manager, are you looking at "Mem Usage" or "VM Size"? "Mem Usage"
is the physical memory the process is using. It should be "VM Size" that is
equivalent to "Private Bytes". We can add/remove columns by menu "View" |
"Select Columns..." in Task Manager.

- If I run this script, what do I need to know if I want to run this from a
remote location. Can I use terminal services?

You may refer to the help of WinDbg:

Crash Mode:

Because crash mode uses an "invasive" attach through the CDB debugger, it
does not work inside a Microsoft Windows NT 4.0 or Windows 2000 Terminal
Server session, as these operating systems will not permit a debugger in
one window station to attach to a process in a different window station.
Crash mode is supported in a Terminal Server session on Windows XP and
later versions of Windows. Hang mode will work inside a Terminal Server
session on any platform.

- What type of impact does it have on performance when it is running
waiting for the crash to occur?

I am not sure how to answer this. Of course there will be performance
penalty. However, it is quite difficult to quantify.

I hope the information will be useful to you.

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 18 '05 #2
In article <Ot**************@cpmsftngxa10.phx.gbl>, v-
fe***@online.microsoft.com says...
Ok,
Thanks for the response. I have added the virtual memory size and now
the private bytes is in line with that. Regarding the private bytes,
here is what I now need to know.

The private bytes shows 1.1 Gb memory while the # Total Managed Bytes
only shows ~125 Mb memory. Why would there be such a big difference
between the managed and private? Is this normal? Are there any other
counters I can use to help figure out what happens.

Throughout the day the CPU will spike to 100% and the GC will start
running. It seems to hold all the resources up while the Memusage goes
down in size. The VM Size stays the same though.

What further can I look at. I plan on using the dump util early next
week but I hope to get more of a diagnosis now to see what it is that I
am looking at. Thanks.

Rich
Hello Rich,

Thanks for posting. I would try to answer some of your questions.

- How is it possible that the total private bytes add up to more than what
is being reported by the task manager.

In Task Manager, are you looking at "Mem Usage" or "VM Size"? "Mem Usage"
is the physical memory the process is using. It should be "VM Size" that is
equivalent to "Private Bytes". We can add/remove columns by menu "View" |
"Select Columns..." in Task Manager.

- If I run this script, what do I need to know if I want to run this from a
remote location. Can I use terminal services?

You may refer to the help of WinDbg:

Crash Mode:

Because crash mode uses an "invasive" attach through the CDB debugger, it
does not work inside a Microsoft Windows NT 4.0 or Windows 2000 Terminal
Server session, as these operating systems will not permit a debugger in
one window station to attach to a process in a different window station.
Crash mode is supported in a Terminal Server session on Windows XP and
later versions of Windows. Hang mode will work inside a Terminal Server
session on any platform.

- What type of impact does it have on performance when it is running
waiting for the crash to occur?

I am not sure how to answer this. Of course there will be performance
penalty. However, it is quite difficult to quantify.

I hope the information will be useful to you.

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 18 '05 #3
Hi Rich,

Thanks for your update. The high virtual memory usage should be abnormal.

On the other hand, we should look at the data based on a time series,
instead of a single point. If there is an unmanaged memory leak problem
(which looks like), I would suggest that we check unmanaged resources in
your web application, e.g. COM components, PInvoke usage and so on.

As far as I know, it is not convenient to track unmanaged memory leak
issues with dumping. We have a tool named "LeakDiag". However, it seems to
me that the tool is not available publicly. You may contact Microsoft
Product Support Services.

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 18 '05 #4
Felix,
Thanks for the response. I have some other information that may be
you can help me make sense of. Here it goes:

As I said before we have this code running on multiple servers in a
cluster (2 to be exact). Neither of the servers is the same when it
comes to processor size or memory. Here are the specs for reference:
Box A:
866mhz 2G ram
Box B:
1.1 ghz 3G ram

Ok so on Box A is the box that has the high virtual memory usage on it.
When looking at the task mgr there is definitely more vm allocated than
mem usage. On every other box that I have looked at (box b inculded)
when looking at the same metrics, the VM is NEVER higher than the mem
usage. The way that I understand VM usage it is the total amount of
memory that the process is using, both in RAM and on Disk. If that is
the case then why would the VM number be lower than the physical memory.
Is it possible for the process to hold onto some physical memory that is
not counted when doing VM counts? This is what it would seem to me but
I just wanted clarification.

As to the potential issue with virtual memory that was not be freed, I
have narrowed it down to what I think is bad coding when it comes to
closing sql connections. When looking at the total # pooled connections
on the offending server, when it is under high memory utilization, there
are roughly 1100 pooled connections. Under higher load that number
keeps increasing. Under moderate load that number stays around for a
while and will scale back some under no load times. I have found at
least one page in an app that seemed to be opening 5-9 connections per
page invocation and not releasing any of them (ie the connection would
fall out of scope without call or dispose being explicityly called.)

Back to the counter that showed a high number of connections opened, why
is it that the number does not go down after an IISReset? How could I
look further into what is happening in the connection pool? I would
have expected that after a reset that the number would dwindle back down
to the zero area but this did not happen even though the asp_wp memory
reset itsself.

Lastly, with me looking back at a connection problem, is this something
that can be diagnosed with a dump or should I still contact PSS to get
me a lead on that LeakDiag?

Thanks again for any help,

Rich

In article <Nf**************@cpmsftngxa10.phx.gbl>, v-
fe***@online.microsoft.com says...
Hi Rich,

Thanks for your update. The high virtual memory usage should be abnormal.

On the other hand, we should look at the data based on a time series,
instead of a single point. If there is an unmanaged memory leak problem
(which looks like), I would suggest that we check unmanaged resources in
your web application, e.g. COM components, PInvoke usage and so on.

As far as I know, it is not convenient to track unmanaged memory leak
issues with dumping. We have a tool named "LeakDiag". However, it seems to
me that the tool is not available publicly. You may contact Microsoft
Product Support Services.

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 18 '05 #5
Hi Rich,

Thanks for your update.

In fact, the term used in Task Manager is inaccurate. In Task Manager, "VM
Size" in fact should be "Private Bytes". "Mem Usage" should be "Working
Set". You may refer to the "Explain" button in "Add Counters" dialog of
Performance Monitor for detailed definition of the terms.

As far as I know, if we run IISReset, the worker process of ASP.Net should
be terminated as well. All the resources should be free, since the process
is shut down.

Regarding the connections, have you explicitly called
"SqlConnection.Close()" method to close the connections? Will it help if we
do so?

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 18 '05 #6
Felix,
Sorry it took so long to get back to you. Life got in the way. Ok so
here is where we are today. The memory on one box seems to grow without
ever being reclaimed before the process is recycled. I had tried to get
a dump of the aspnet_wp.exe process by running in adplus in hang mode.

Oddly, when I created the dump while the memory VM usage was around
1.1 Gb the dump that was generated did not create the dmp file. I had
to reset the process and let the memory build up a bit in order to get a
dump. At lower memory utilizations, the .dmp file was created
correctly. Once the memory reached around 400Mb I was not able to get a
*.dmp file to generate.

**1. Are there any known issues where .dmp files are not created? The
folder structure gets created and the log file even shows up but not dmp
file.

**2. Is there anything that the log may tell me that is useful or do I
need the .dmp file in question.

Regarding the reading of the dump file, is there anything that I need
to do other than what is outlined in the "Production Debugging for .NET
Framework Applications"?

Thanks.

Rich
In article <KW**************@cpmsftngxa10.phx.gbl>, v-
fe***@online.microsoft.com says...
Hi Rich,

Thanks for your update.

In fact, the term used in Task Manager is inaccurate. In Task Manager, "VM
Size" in fact should be "Private Bytes". "Mem Usage" should be "Working
Set". You may refer to the "Explain" button in "Add Counters" dialog of
Performance Monitor for detailed definition of the terms.

As far as I know, if we run IISReset, the worker process of ASP.Net should
be terminated as well. All the resources should be free, since the process
is shut down.

Regarding the connections, have you explicitly called
"SqlConnection.Close()" method to close the connections? Will it help if we
do so?

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 18 '05 #7
Hello Rich,

Thanks for your reply. I am not aware of any known issues about large dump
files. Do we have enough disk spaces? When the dump is generated, we should
observer disk activities.

The log file may not provide enough information regarding the problem.

I would still recommend that you contact Product Support Service for the
memory leak issue.

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 18 '05 #8

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

Similar topics

8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
6
by: Ken Varn | last post by:
I am trying to remote debug a C# application but the debugger is reporting the following exception: An unhandled exception of type 'System.IO.FileLoadException' occurred in Unknown Module....
15
by: DavidS | last post by:
Have Visual Studio.NET installed on MS 2000 Professional OS laptop. No issue ever with web development and SQL connections. Purchased new laptop with XP Professional SP2!!!!!!!! & Visual...
6
by: gerry | last post by:
I am almost at the end of my rope - I have to go through this process everytime a new version of studio is released or it is installed on a new machine - what a (^%&$^& pain. I am trying to...
23
by: keyser_Soze | last post by:
I have MS Visual Studio 2003 on Windows XP Pro. I have IIS running on this machine and I am trying to debug some existing code which has both ASP and ASP.NET components. When I try and launch...
7
by: | last post by:
I'm writing an ASP.NET app, using Visual Studio 2003. VS is running locally on my laptop, but the web app is running on a remote server. My laptop is not in the domain. I do have a domain account....
3
by: Rick | last post by:
We have a web site that was built as an ASP.Net Web Site, I am unable to remote debug, when build ing the web site there is not a dll or PDB file generated. I can debug on my local machine but...
33
by: fmassei | last post by:
Hello! I made a short piece of code that I find very useful for debugging, and I wanted to ask you if it is correct, somehow acceptable or if I simply reinvented the wheel. To deal with some bad...
7
by: GaryDean | last post by:
(this was also posted on the MSDN WCF forum but the answers over there are not so good) I have a WCF Library hosted by IIS 6 and it all works fine. However I need to step through the code in the...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.