.Net 2.0 application hangs during startup

Use this forum for questions on how to use .NET Memory Profiler and how to analyse memory usage.
Post Reply
nevillev
Posts: 5
Joined: Wed Dec 07, 2005 10:02 pm

.Net 2.0 application hangs during startup

Post by nevillev » Wed Dec 07, 2005 10:11 pm

I'm in the process of evaluating the Memory Profiler; and my first experience has not been as good as I'd hoped:

I have a .NET 2.0 (RTM) Windows Forms application that uses web services to access a middle-tier server. When I Start the application using the profiler, it starts up and seems to run up to the point where it starts accessing the server. Then it hangs. Nothing more happens at all. If I kill it via Task Manager then the Memory Profiler asks me whether I want to save the (empty) sesson.

If I use a simpler application which uses no web services then it runs just fine.

I've tried changing various settings:
-No debug symbols
-Unchecked Disable inlining
-Checked Enable low impact profiling
-Unchecked Enable root referee identification
-Unchecked Suspend thread until memory leak is handled

Unfortunately I cannot make the behavior change.

I'm using v2.6.64.0 of the .NET Memory Profiler; and running it in normal interactive mode; outside of the VS 2005 environment.

I'd appreciate any help or hints.

Thanks,
-Neville

nevillev
Posts: 5
Joined: Wed Dec 07, 2005 10:02 pm

More information

Post by nevillev » Thu Dec 08, 2005 12:00 am

I went a little further in trying to analyze what's happening, and did the following:
  • Put a MessageBox before the web service calls
    Started the application using the Profiler with VS2005 IDE integration (rt-click Start Memory Profiler)
    When the MessageBox appeared, I then attached the debugger to the process and set it to catch all Managed Exceptions.
    Then I closed the MessageBox so that I could see where the app got stuck.
I had two similar experiences on the same line of code within my app: In the one case it just exited (the exit code was 0x800703e9, which is a StackOverflowException - HRESULT COR_E_STACKOVERFLOW) and in another case I got a first-chance stack overflow exception in the debugger, and could look at the stack; which didn't look bad to me.

In both cases the strange behavior occurred on a call into an instance method that's marked with this attribute:

Code: Select all

[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.Synchronized)]
I should mention that the app is multi-threaded.

Is it possible that this synchronization is causing the problem?

Thanks,
-Neville

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

Post by Andreas Suurkuusk » Thu Dec 08, 2005 10:13 am

Thank you for the detailed information about this problem.

I doubt that the "MethodImplOptions.Synchronized" option is responsible for the stack overflow exception, but we will of course do some further investigation.

Anyway, we will probably be able to pinpoint where the problem occurs if you could send us log-files from the profiler.

To create the log files you must supply the "/log" command line argument to the profiler executable (NetMemProfiler.exe). This will create three log-files in the program directory: ProfilerLog.txt, ProfilerClientLog.txt and AssertLog.txt (AssertLog.txt will probably be empty). After you have created the log-files, you can send them to support@scitech.se (preferably zipped).
Best regards,

Andreas Suurkuusk
SciTech Software AB

nevillev
Posts: 5
Joined: Wed Dec 07, 2005 10:02 pm

Post by nevillev » Thu Dec 08, 2005 7:04 pm

I've emailed the logs.

I agree with you that it seems unlikely to have anything to do with MethodImplOptions, or web service calls at all.

Hopefully you can find out what is happening.

Regards,
-Neville

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

Post by Andreas Suurkuusk » Thu Dec 08, 2005 8:31 pm

I have taken a look at the log-files you sent to support@scitech.se. They indicate that the problem is related to the ItemDetailsImpl class and the DataWorks.MI.Core.Internal.ItemImpl class.

While the profiler tries to retrieve information for the ItemDetailsImpl class, it needs to retrieve information about the DataWorks.MI.Core.Internal.ItemImpl class. The problem is that this class in turn causes information about ItemDetailsImpl to be retrieved, which causes an infinite recursion.

Is it possible for you to send us additional information about those two classes (either to this forum or to support@scitech.se)? Hopefully we can reproduce the problem if we know what the classes look like.
Best regards,

Andreas Suurkuusk
SciTech Software AB

nevillev
Posts: 5
Joined: Wed Dec 07, 2005 10:02 pm

Post by nevillev » Fri Dec 09, 2005 6:37 pm

I have emailed a zip of the classes to you. They are, unfortunately, large and complex.

The most obvious relationship between them is that ItemDetailsImpl is an nested class within ItemImpl, and there are a number of deep relationships between them.

Hopefully this helps.

Regards,
-Neville

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

Post by Andreas Suurkuusk » Sun Dec 11, 2005 9:29 pm

We have looked at the classes you sent us, and we have managed to solve the problem. It was caused by the fact that a generic parameter in the super class referenced the class that was being defined, which caused the profiler to get stuck in a infinite recursion.

A fix for this error will be included in the next update, which will released during the next week.
Best regards,

Andreas Suurkuusk
SciTech Software AB

nevillev
Posts: 5
Joined: Wed Dec 07, 2005 10:02 pm

Post by nevillev » Tue Dec 13, 2005 12:56 am

This is excellent news! And great support too :-)

I look forward to trying it out again with the update.

Regards,
-Neville

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

Post by Andreas Suurkuusk » Wed Dec 14, 2005 7:04 pm

Now we have released an update of the profiler (v2.6.66), which should solve your problem. You can download it from http://memprofiler.com/download.aspx.
Best regards,

Andreas Suurkuusk
SciTech Software AB

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests