Trying to profile service

Use this forum for questions on how to use .NET Memory Profiler and how to analyse memory usage.
Post Reply
MikeB
Posts: 7
Joined: Wed Dec 05, 2007 6:43 pm

Trying to profile service

Post by MikeB » Mon Feb 09, 2009 11:07 pm

Windows Server 2008
Microsoft Visual Studio 2008
.Net Memory Profiler 3.1.321.0

First I select the 'Profile Service' option.
A list of services pops up and I select the service I am looking for.
I choose to restart the service and I now appear to be profiling.
I take a snapshot.
Everything appears to be working fine.
After my service has done something (about a minute), I click for another snapshot.
I get a message box that states...

"The operation failed with the following error: Profiling stopped unexpectedly when collecting snapshot."

I click OK, and .netMemoryProfiler stops profiling. If I want to attach, I have to restart my service.

Am I doing something in my service that is inhibiting .netMemoryProfiler from doing its job?

Any help would be appreciated.

Related: If I take a snapshot on my service prior to it doing something, I don't get any errors -- mem profiler takes the snapshot just fine.


**********************
Thanks for the help!!!!!

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

Post by Andreas Suurkuusk » Tue Feb 10, 2009 10:05 pm

It should not be possible for your service to do anything that will inhibit .NET Memory Profiler from collecting a snapshot, so I don't know why your process gets terminated.

The best way for us to get the necessary information about this problem, is to investigate the log-files from the profiler. To simplify the creation of the log-files, we have added the possibility to specify the log-file folder using a command-line argument. However, it's only possible to specify the folder in the latest build of .NET Memory Profiler (3.1.328). Can you download the latest release from http://memprofiler.com/MemProfilerInstaller3_1_328.msi (or http://memprofiler.com/MemProfilerInsta ... -64bit.msi for the 64-bit version)?

Once you have installed the latest build, the log-files are created by providing the "/log:<path>" command line argument to the profiler executable (e.g. using the Run command and entering "C:\Program files\SciTech\NetMemProfiler3\NetMemProfiler.exe" /log:c:\MemProfilerLogs).

This will create three log-files: ProfilerLog.txt, ProfilerClientLog.txt and AssertLog.txt. The log-files will be created in the folder specified by <path>, e.g. C:\MemProfilerLogs.

Please send them to support@scitech.se (preferably zipped). Hopefully they will provide enough information to solve this problem.
Best regards,

Andreas Suurkuusk
SciTech Software AB

MikeB
Posts: 7
Joined: Wed Dec 05, 2007 6:43 pm

Post by MikeB » Wed Feb 11, 2009 10:22 pm

Just wanted to let you know that I sent an e-mail to support with the error logs attached.

For those following along at home....

My AssertLog was empty
My ProfilerLog had about 298k lines in it.
My ProfilerClientLog had about 180 lines in it and ended about 20 lines after this....

2009-02-11 07:47:43.5135|1|WARN|SciTech.NetMemProfiler.ProfilerAsyncWorker|Async operation failed
SciTech.NetMemProfiler.ProfilerException: Profiling stopped unexpectedly when collecting snapshot.
at SciTech.NetMemProfiler.cw.f()
at SciTech.NetMemProfiler.cw.a(a9 A_0, ar A_1, Boolean A_2)
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)


Thanks for looking and please let me know if you didn't get it.

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

Post by Andreas Suurkuusk » Thu Feb 12, 2009 4:13 pm

Thank you for the log-files.

I have now taken a look at them. Unfortunately, they didn't provide any conclusive information about why the process is terminated, but they at least indicated the problem area.

To pinpoint the problem, I have made some modificiations to the profiler and added some extra logging. Can you create new log-files using the latest build? It can be downloaded from http://memprofiler.com/MemProfilerInstaller3_1_331.msi (or http://memprofiler.com/MemProfilerInsta ... -64bit.msi for the 64-bit version).

Please send the log-files to us even if you successfully collect the snapshot. I added some safeguards that might prevent the service from terminating, but I still like to know what happened.
Best regards,

Andreas Suurkuusk
SciTech Software AB

MikeB
Posts: 7
Joined: Wed Dec 05, 2007 6:43 pm

Post by MikeB » Thu Feb 12, 2009 5:59 pm

I couldn't get this build to create any log files. I attached screenshots of what happened to an e-mail.

THANKS!!

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

Post by Andreas Suurkuusk » Thu Feb 12, 2009 7:07 pm

The reason for this error is that you used a '\' in your command line instead of a '/'. This will cause the profiler to profile the application named "\log:c:\MemProfilerLogs", which will not work.

It seems like my safeguard didn't help, since the process still terminates. Hopefully the new log-files will help locating the cause of this. Thanks for your help so far.
Best regards,

Andreas Suurkuusk
SciTech Software AB

MikeB
Posts: 7
Joined: Wed Dec 05, 2007 6:43 pm

Post by MikeB » Thu Feb 12, 2009 8:36 pm

Wow. I feel sheepish. Sorry about that.

I e-mailed the new logs.

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

Post by Andreas Suurkuusk » Mon Feb 16, 2009 10:17 pm

I have investigated the log-files you sent. Even if they got me closer to the problem I still cannot find an explanation for it. For some reason the service terminates, without any exception, while the profiler is retrieving information about instance fields. Is there any possibility that the service is terminated by some monitoring process or thread (e.g. if the service doesn't respond)?

Anyway, to get even closer to the point where the service terminates, we have added even more logging. If you find the time, I would appreciate if you could download the latest build and create new log-files again. The latest release can be downloaded from http://memprofiler.com/MemProfilerInstaller3_1_332.msi (or http://memprofiler.com/MemProfilerInsta ... -64bit.msi for the 64-bit version).
Best regards,

Andreas Suurkuusk
SciTech Software AB

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

Post by Andreas Suurkuusk » Wed Feb 18, 2009 9:35 pm

The latest log-files you sent revealed the exact position of the error. It's a call into the .NET runtime that for some reason causes the process to terminate. The particular call that caused the termination can actually be avoided. It should have returned a failure HRESULT (instead of crashing), so now we perform some initial checks and avoid calling this function when not necessary. Hopefully this will solve your problem. Can you please download the latest build from http://memprofiler.com/MemProfilerInstaller3_1_333.msi (or http://memprofiler.com/MemProfilerInsta ... -64bit.msi).

If you still fail to collect a snapshot, can you create new log-files for us? If there's still a problem, there might be some other underlying cause.
Best regards,

Andreas Suurkuusk
SciTech Software AB

Post Reply

Who is online

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