Non stopping snapshot

Memory profiling for .NET developers

Moderators: Luke Jefferson, StephenC, AndrewH, melvyn.harbour, james.billings, Laura Morley, dene.boulton

Non stopping snapshot

Postby JeromeAvoustin » Wed Dec 07, 2011 5:59 pm

Hi everybody,

i've tried to find qnswers to my problem on this forum, but I didn't find one...

I've a Winform application to profile, in order to understand how memory is managed, and explain crashes on 32bits platforms. This application is written in C#, and call a C++/Win32 API, via a C++/CLI client library.

It seems that memory is completely occupied by unmanaged memory, because Private Bytes are high (1 Go) while Bytes in Heaps are low (50 Mo).

Problem is : I've launched a snapshot 40 min ago, AND IT'S STILL RUNNING !!

I've reproduced it a few times (100% reproductible). It seems to happen once I've made a certain action on the UI (opening a custom project and gathering data). Before doing this action, I'm able to take some snapshots quite fast (a few seconds, less than a minute), and memory is about 512 Mo (private bytes)

Does anyone know how to handle it ?

I think I'll wait very long (maybe all night)
JeromeAvoustin
 
Posts: 7
Joined: Wed Dec 07, 2011 5:42 pm

Postby JeromeAvoustin » Thu Dec 08, 2011 10:31 am

Well... bad experience...
the computer switched off during the night
I'm trying to make another long snapahot (45 min from now...)

Any help would be appreciated
BTW I'm going to test Yourkit and dotTrace...
I hope they'll work...
JeromeAvoustin
 
Posts: 7
Joined: Wed Dec 07, 2011 5:42 pm

Postby AndrewH » Thu Dec 08, 2011 3:11 pm

Are any processes using CPU while the snapshot is taking place? v7.0 and earlier of the profiler had a bug where the progress bar would not hide after a snapshot had completed (the cases we know about were fixed in v7.1). Additionally, if the target process is responsive, then the snapshot has completed and something has gone wrong with the ANTS UI.

For 50Mb of .NET objects, a snapshot shouldn't take more than a second, and we've tested the profiler up to 30 million objects (which is about as many as you can possibly fit into a 32-bit process) - at this extreme, it still shouldn't take more than 5 minutes or so to take a snapshot and load it in.
Andrew Hunter
Software Developer
Red Gate Software Ltd.
AndrewH
 
Posts: 134
Joined: Thu Aug 17, 2006 3:44 pm

Postby JeromeAvoustin » Thu Dec 08, 2011 3:23 pm

Hi Andrew,

Thanks for your answer.
Well, I still don't understand why the profiler still runs.

ANTS UI is responsive, and I can see memory counters graph movig, I can zoom on it, etc.
On the other hand, the application UI isn't responsive anymore.
And no other process is running.

I'm running the whole on Windows XP 32bits SP3.
This is the platform where we encounter our memory problems.
JeromeAvoustin
 
Posts: 7
Joined: Wed Dec 07, 2011 5:42 pm

Postby JeromeAvoustin » Thu Dec 08, 2011 3:24 pm

Do you know if it is possible to get a thread dump of memory profiler to sse where it is blocking ?
JeromeAvoustin
 
Posts: 7
Joined: Wed Dec 07, 2011 5:42 pm

Postby Brian Donahue » Fri Dec 09, 2011 2:36 pm

Since Memory Profiler introduces some code into your program as it's being profiled, it is possible that it's caused a synchronization or blocking issue in there, but we would need a stack dump to see if this is the case.

You can create a memory dump using adplus. If you want to do that, let me know and I will set up a private FTP account for you to send the dump and PM you with the login details.

To get the dump:
  • download ftp://support.red-gate.com/utilities/autodumper.zip
  • Extract all files (eg to c:\\dumper)
  • While your process is being profiled and still running, open a command prompt and type:
  • cscript adplus.vbs -hang -pn <name of the process you are profiling>
  • Another window should open running cdb.exe
  • If the application is stalled, adplus should write a full memory dump (.dmp file in a subfolder of c:\\dumper)
Brian Donahue
 
Posts: 6670
Joined: Mon Aug 23, 2004 10:48 am

Postby Brian Donahue » Mon Dec 12, 2011 1:04 pm

It looks from the stack trace like there is some sort of deadlock caused by an access violation that tries to shut down the .NET Runtime. The runtime doesn't shut down, though. Do you see any dialogs that need to be closed or anything?

If not, can you please try adplus in "crash" mode? We would be interested in any 1st/2nd chance exceptions happening in the program. (cscript adplus.vbs -crash -pn <name of process>)
Brian Donahue
 
Posts: 6670
Joined: Mon Aug 23, 2004 10:48 am

Postby JeromeAvoustin » Tue Dec 13, 2011 6:11 pm

Sorry, I didn't notice your post.
I'm gonna try it tomorrow if you don't mind.
It's in my toto-list.

I come back to you ASAP
JeromeAvoustin
 
Posts: 7
Joined: Wed Dec 07, 2011 5:42 pm

Postby JeromeAvoustin » Wed Dec 14, 2011 1:22 pm

Hi Brian,

I've launched the script but it didn't seem to "move" until I pressed ctrl+C.
It has started to produce some data.
When this is finished, I'll send it to you.

By the way, I've managed to NOT reproduce the problem, and to finally generate a snapshot quite quickly.
Our analysis was made on a Windows XP SP3 32bits.
And we've seen that the overall virtual memory needed by our application were not going above 2GB, which is the maximum XP 32bits can allocate to an application.
We've finally activated the /3GB switch of XP, and we didn't notice any Out of Memory error anymore, and as I said, we managed to take a snapshot.

I'll send you the crash report. But we might have found the problem.
It still doesn't explain why the snapshot isn't taken.
JeromeAvoustin
 
Posts: 7
Joined: Wed Dec 07, 2011 5:42 pm

Postby Brian Donahue » Wed Dec 14, 2011 4:41 pm

Thanks - I'll have a look. I believe we have already tried to reproduce the issue by running the process out of memory but the Runtime did shut down and not hang up like it did in your case.
Brian Donahue
 
Posts: 6670
Joined: Mon Aug 23, 2004 10:48 am

Postby Brian Donahue » Fri Dec 16, 2011 10:11 am

Sorry - we cannot isolate the cause of this because the .NET Runtime is not behaving correctly. It indicates it is shutting down but never completes the shutdown and there aren't any Profiler methods on the stack. If the Runtime never shuts down cleanly then ANTS Profiler can't finish what it is doing either.

Best suggestion we have is to try to prevent the access violation that is happening in your code but as this is your code we have no advice about how to do that.
Brian Donahue
 
Posts: 6670
Joined: Mon Aug 23, 2004 10:48 am

Postby JeromeAvoustin » Fri Dec 16, 2011 11:02 am

OK Brian,

Thanks to all the time you spent.
At least, I think taht it is simply a lack of virtual memory, causing a shutdown.
But there are too many technological stacks (C++/Qt, C++/CLR, C#, WPF) and both managed and unmanaged code that I think I won't find the answer for my part.

Jerome
JeromeAvoustin
 
Posts: 7
Joined: Wed Dec 07, 2011 5:42 pm


Return to ANTS Memory Profiler 7

Who is online

Users browsing this forum: No registered users and 0 guests