Failed to collect heap snapshot.

Use this forum for questions on how to use .NET Memory Profiler and how to analyse memory usage.
ako
Posts: 6
Joined: Wed Jul 18, 2007 8:53 pm

Failed to collect heap snapshot.

Post by ako » Wed Jul 18, 2007 9:02 pm

I keep getting this error now whenever I try to collect a heap snapshot:

The operation failed with the following error:
Object reference not set to an instance of an object.

I'm using version v3.0.122.C on Windows XP. This happens in both VS 2005 and in the standalone app. I've been able to create the snapshot on a small test app and it worked on earlier versions of our app, but not anymore.

We have recently done some major refactoring of our code base and that's when this error started to happen. Any ideas on how to get this working again?

Andreas Suurkuusk
Posts: 1029
Joined: Wed Mar 02, 2005 7:53 pm

Post by Andreas Suurkuusk » Thu Jul 19, 2007 10:22 pm

In order to solve this we will need some additional information about the problem. Could you provide us with the log file from the profiler?

The log file is named "ProfilerClientLog.txt" and is stored under the "C:\Documents and settings\<User>\Application data\SciTech\MemProfiler3" folder. You can send this file to support@scitech.se after you have received the error message.

Is the resource tracker enabled when this error occurs?
Best regards,

Andreas Suurkuusk
SciTech Software AB

ako
Posts: 6
Joined: Wed Jul 18, 2007 8:53 pm

Post by ako » Thu Jul 19, 2007 10:50 pm

Ok, log file sent. I've been able to capture some snapshots by trying different workflow scenarios with our app. Seems it is just this one case I have been testing. The app is built using .Net 3.0 btw.

I'm just using whatever the defaults are so I don't think the resource tracker is enabled. If you mean the unmanaged resource tracker then it is not enabled.

Andreas Suurkuusk
Posts: 1029
Joined: Wed Mar 02, 2005 7:53 pm

Post by Andreas Suurkuusk » Sun Jul 22, 2007 9:35 am

Thank you for the log-file. However, when investigating the file I couldn't find any indication of a problem. The log-file gets recreated each time you start the profiler so it has to be retrieved after the problem occurs, but before restarting the profiler. Did any collection problem occur while the file you sent was created?

Yes, I was referring to the unmanaged resources tracker.
Best regards,

Andreas Suurkuusk
SciTech Software AB

bhelzer
Posts: 4
Joined: Thu Aug 02, 2007 7:36 pm

I have the same problem

Post by bhelzer » Thu Aug 02, 2007 7:41 pm

I have the same problem, except that it happens almost everytime. The log file didn't have any errors in it. This is really stopping me from using the product.

ako
Posts: 6
Joined: Wed Jul 18, 2007 8:53 pm

Post by ako » Thu Aug 02, 2007 7:55 pm

Yeah, I made sure I copied the log file after the problem occurred.

Andreas Suurkuusk
Posts: 1029
Joined: Wed Mar 02, 2005 7:53 pm

Post by Andreas Suurkuusk » Fri Aug 03, 2007 1:03 pm

After looking into this issue, I noticed that the currently released version (3.0.122) does not write an entry to the log-file when an error occurs while collecting a snapshot. This has now been corrected, and we have built a new version (3.0.134). It has not been officially released but it can be downloaded from http://memprofiler.com/MemProfilerInstaller3_0_134.msi or http://memprofiler.com/MemProfilerInsta ... -64bit.msi (for the 64-bit version).

I would appreciate if you (ako or bhelzer) could download the new version and try again. The problem will most likely still exist, but the log-file will hopefully provide some additional information. Also, it would be good if you could provide the /log parameter to the profiler executable (NetMemProfiler.exe). This will create two additional log-files: ProfilerLog.txt and AssertLog.txt. These log-files contains more detailed information from the profiled process, and could contain useful information pertaining to this problem.
Best regards,

Andreas Suurkuusk
SciTech Software AB

bhelzer
Posts: 4
Joined: Thu Aug 02, 2007 7:36 pm

Post by bhelzer » Fri Aug 03, 2007 4:33 pm

That helped. Here is the relevant section of the log file.

Code: Select all

2007-08-03 10:28:56.2095|INFO|SciTech.NetMemProfiler.ProfilerClient|Collection finished
2007-08-03 10:28:56.9126|WARN|SciTech.NetMemProfiler.ProfilerAsyncWorker|Async operation failed
System.NullReferenceException: Object reference not set to an instance of an object.
   at SciTech.NetMemProfiler.ProfilerComparison.a(UInt32 A_0, ManagedType A_1)
   at SciTech.NetMemProfiler.ProfilerComparison.c()
   at SciTech.NetMemProfiler.ProfilerComparison.d()
   at SciTech.NetMemProfiler.ProfilerComparison.a(r A_0)
   at SciTech.NetMemProfiler.ActiveSession.b(Object A_0, String A_1, Boolean A_2)
   at SciTech.NetMemProfiler.ActiveSession.a(Object A_0, String A_1, Boolean A_2)
2007-08-03 10:30:01.3679|ERROR|SciTech.NetMemProfiler.ProfilerClient|Exception caught in ReportListener: 
System.IO.EndOfStreamException: Unable to read beyond the end of the stream.
   at System.IO.__Error.EndOfFile()
   at System.IO.BinaryReader.FillBuffer(Int32 numBytes)
   at System.IO.BinaryReader.ReadInt16()
   at SciTech.NetMemProfiler.co.c()
2007-08-03 10:30:02.1804|INFO|SciTech.NetMemProfiler.ProfilerClient|ProfilerClient.RequestStop entered, reason=ApplicationTerminated, error=

ako
Posts: 6
Joined: Wed Jul 18, 2007 8:53 pm

Post by ako » Fri Aug 03, 2007 4:50 pm

Yeah, my log now has similar information.

Code: Select all

2007-08-03 10:43:51.5668|WARN|SciTech.NetMemProfiler.ProfilerAsyncWorker|Async operation failed
System.NullReferenceException: Object reference not set to an instance of an object.
   at SciTech.NetMemProfiler.ProfilerComparison.a(UInt32 A_0, ManagedType A_1)
   at SciTech.NetMemProfiler.ProfilerComparison.c()
   at SciTech.NetMemProfiler.ProfilerComparison.d()
   at SciTech.NetMemProfiler.ProfilerComparison.a(r A_0)
   at SciTech.NetMemProfiler.ActiveSession.b(Object A_0, String A_1, Boolean A_2)
   at SciTech.NetMemProfiler.ActiveSession.a(Object A_0, String A_1, Boolean A_2)
The assert log had about 30 lines of this:

Code: Select all

.\InstanceDataCollector.cpp(319) : Assertion failed!

Andreas Suurkuusk
Posts: 1029
Joined: Wed Mar 02, 2005 7:53 pm

Post by Andreas Suurkuusk » Mon Aug 06, 2007 6:30 pm

Thank you very much for the information. For some reason, the Type of at least one instance is unknown by the profiler. This should of course not happen, but we will need more information to try to find out what's happening. We have built a new version with some minor modifications, and some extra logging. It has not been officially released but it can be downloaded from http://memprofiler.com/MemProfilerInstaller3_0_135.msi or http://memprofiler.com/MemProfilerInsta ... -64bit.msi (for the 64-bit version).

I would appreciate if any of you could download and try this version, with logging enabled (using the /log switch). We're interested in seeing all created log-files, so it would be good if you could zip the files ProfilerClientLog.txt, ProfilerLog.txt and AssertLog.txt and send them to support@scitech.se.

Thank you for your help.
Best regards,

Andreas Suurkuusk
SciTech Software AB

bhelzer
Posts: 4
Joined: Thu Aug 02, 2007 7:36 pm

Post by bhelzer » Wed Aug 08, 2007 4:14 pm

Brief update: I downloaded the new build, but now I cannot recreate the problem. Not sure if it is your build, or changes to our program.
I will keep trying.

ako
Posts: 6
Joined: Wed Jul 18, 2007 8:53 pm

Post by ako » Wed Aug 08, 2007 4:47 pm

Yeah, with this new build I cannot get the error message to show anymore. This is testing with the same code, so nothing changed there. There is an error in the log though:

Code: Select all

2007-08-08 10:36:08.7816|ERROR|SciTech.NetMemProfiler.ProfilerComparison|Type (0) of instance is not available in UpdateComparedTypeInstances
Anyway, I emailed the three logs to support.

bhelzer
Posts: 4
Joined: Thu Aug 02, 2007 7:36 pm

Post by bhelzer » Wed Aug 08, 2007 5:00 pm

I have the same error followed by another one:

Code: Select all

2007-08-08 10:52:07.9318|INFO|SciTech.NetMemProfiler.ResourceTracker.e|Comparison append finished
2007-08-08 10:52:08.3234|ERROR|SciTech.NetMemProfiler.ProfilerComparison|Type (0) of instance is not available in UpdateComparedTypeInstances
2007-08-08 10:56:32.8192|ERROR|SciTech.NetMemProfiler.ProfilerClient|Exception caught in ReportListener: 
System.IO.EndOfStreamException: Unable to read beyond the end of the stream.
   at System.IO.__Error.EndOfFile()
   at System.IO.BinaryReader.FillBuffer(Int32 numBytes)
   at System.IO.BinaryReader.ReadInt16()
   at SciTech.NetMemProfiler.cn.c()
2007-08-08 10:56:33.8817|INFO|SciTech.NetMemProfiler.ProfilerClient|ProfilerClient.RequestStop entered, reason=ApplicationTerminated, error=

Andreas Suurkuusk
Posts: 1029
Joined: Wed Mar 02, 2005 7:53 pm

Post by Andreas Suurkuusk » Thu Aug 09, 2007 7:10 am

Thank you again for the information and the log-files. As I understand from your description (and the log entries), the snapshot collection is now working correctly?

What happens is that an instance is reported by the runtime with a class id that is unknown to the profiler. I don't know why this happens, but in the version you received, we made sure that it would not cause an exception. Using the new information from the provided logs, we have modified the fix a little and added some additional logging. The new version is available at http://memprofiler.com/MemProfilerInstaller3_0_136.msi or http://memprofiler.com/MemProfilerInsta ... -64bit.msi (for the 64-bit version). You should be able to collect snapshots using this version, but it would be good if you could try it and send the log-files to us (especially the big ProfilerLog.txt file).

I really appreciate your help with this. Since we cannot reproduce the error ourselves, we are dependent on you providing us with log-files.
Best regards,

Andreas Suurkuusk
SciTech Software AB

ako
Posts: 6
Joined: Wed Jul 18, 2007 8:53 pm

Post by ako » Mon Aug 13, 2007 4:20 pm

Thanks for getting this fixed so quickly. :)

Everything seemed to run fine without any errors. I sent the final logs to support.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 20 guests