Solved

What is the best way to diagnose reason for an application not responding?

Posted on 2014-09-16
9
240 Views
Last Modified: 2014-09-25
Hi experts
I'd written a winform C# application. Recently, I was told by an internal customer that the application would occasionally become not responding when it is re-accessed after leaving it idle for a while. When the situation happened, the application needed to be forcefully terminated.

I am not sure whether it was due to a fault inside my application, or other applications that were running at that time, or Windows issue.

What is the best way to diagnose this sort of problem?

Thanks in advance.
0
Comment
Question by:dominicwong
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 11

Expert Comment

by:Joseph O'Loughlin
ID: 40324777
One tool is sysinternals procmon.
Filter on your app to see what registry keys, files etc are open, what permissions are being checked (checking permissions on a domain account can sometimes be the delay).
0
 
LVL 15

Accepted Solution

by:
Karrtik Iyer earned 250 total points
ID: 40325391
Hi,
I would start off with the following steps, not in any particular order: ( I don't see any straight forward solution)
1. Analyze the logs of my .Net application for 2-3 scenarios that result in non responsive conditions, identify if there is any particular operation or user action which is triggering this issue?
2. If your code is multi-threaded, then I shall also analyze my shared resources to see if there is any resource for which some thread is waiting infinitely. Also ensure that there are no static resources in this code.
3. Also if you are doing any file i/o etc.. I would check if the same file is open in some other process. The same holds good if you are using a DB and if the record that you are trying to access is locked and your thread is waiting infinitely.
4. Also alternatively look at the other operations happening on that system at the same time when your apps becomes unresponsive.
5.  Also check my code if there is any recursive logic which gets triggered on a condition that results in infinite loop.
6. Do static and dynamic analysis/profiling of C# code using Microsoft tools.
Thanks,
Karrtik
0
 

Author Comment

by:dominicwong
ID: 40326894
Thanks Karrtik.
Could you give me the names of these static and dynamic analysis/profiling Microsoft tools please?
0
 
LVL 15

Expert Comment

by:Karrtik Iyer
ID: 40327874
Hi Dominic,

Here are some links, you can get them from Google search as well if you search of visual studio code analysis.
I am not sure which version of visual studio you are using, I have posted 2012 version's links.
Please let me know if you need further help.
Thanks,
Karrtik

Using Code Analysis with Visual Studio
Code Analysis Team Blog
Analyzing Application Quality by Using Code Analysis Tools
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 2

Assisted Solution

by:BakuRetsu_X
BakuRetsu_X earned 100 total points
ID: 40328714
Tell us more about your application.
What does it do?  How does it run?  How does it log errors?
Are you using unmanaged 3rd party code? COM items?
Is it marshaling methods?

Have you check the eventvwr to see if there are any alerts or warning logged?
0
 

Author Comment

by:dominicwong
ID: 40332046
Thanks BakuRetsu X.
The problem just happened again. It was sitting idle, and the user tried to open a file through the application.
I checked the memory of the process. It was fairly minimal so it wasn't a memory leakage issue.
Just tried using the sysinternals "handle" and "process explorer" tools, I could see the application was still running: created thread and exit from thread.
The application logs errors by writing to a local file. There're some unmanaged 3rd party code and marshalling methods. But I don't think the marshalling methods were running when the problem happened.
No, I haven't checked the eventvwr.
0
 

Author Comment

by:dominicwong
ID: 40332050
Thanks Karrtik for sharing me the links. I am using VS2008.
0
 
LVL 11

Assisted Solution

by:Joseph O'Loughlin
Joseph O'Loughlin earned 150 total points
ID: 40333742
File operations can be interfered by 'handlers', and there can be several daisy-chained together, for example the normal file open operating system operations, an open file agent like (volume) shadow copy, a document management program and an antivirus program checking to see if the file is safe.  
Use procmon to filter on the file and see what's stomping on it.
Also compare the output of (running cmd.exe as administrator with elevation)
C:\> vssadmin list providers
C:\> vssadmin list shadows
C:\> vssadmin list writers
between the problem machine and similarly configured non problem machine
Also check for corruption.
0
 

Author Closing Comment

by:dominicwong
ID: 40345180
I have yet to find out the real cause of the problem. But thanks everyone for your valuable input.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
OfficeMate Freezes on login or does not load after login credentials are input.
This Micro Tutorial will teach you the basics of configuring your computer to improve its speed. It will also teach you how to disable programs that are running in the background simultaneously. This will be demonstrated using Windows 7 operating…
This Micro Tutorial will teach you how to change your appearance and customize your Windows 7 interface to your unique preference. This will be demonstrated using Windows 7 operating system.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now