nepa
nepa

Reputation: 1462

Freezing managed threads

I'm working on a quite big application that is in charge of doing real-time motion tracking and camera movement controlling. Its tasks are:

The application uses .NET 4.0 and has a WPF user interface.

Managed threads freezing

From the beginning we had to face managed threads that freeze for between 500 to 1500ms, which is really much for a real-time application like this.

To find out when these hangs occur I created a thread whose only task is to do a sleep for 100ms all the time. I then calculated how long the sleep really took and got exactly the times when the camera movement stopped. It works very reliably, the threads all hang at the same time!

Unmanaged threads don't freeze

While all the managed threads freeze the unmanaged threads work without any problem. We check that by logs that are written independent from the managed part of the application.

Analysis

I tried to figure out with phenomenons could maybe cause this behaviour:

Hints on how to investigate into this would be highly appreciated. Thank you very much!

Upvotes: 1

Views: 436

Answers (2)

Davin Tryon
Davin Tryon

Reputation: 67296

I would suggest taking a process dump as you are encountering the performance problem. You can do this several ways (taskmgr.exe or procdump.exe from SysInternals). Take a full memory dump.

Once you have the .dmp file, you can analyze it with windbg (or Visual Studio 2010). For managed processes you need to load the sos.dll extensions.

There are a lot of good windbg resources out there, but here are a few that have helped me:

1) Tess Fernandez video (ASP.NET process, but the techniques are the same)

2) WinDbg cheatsheet

The memory analysis will be able to give you the stack (!clrstack) while you are encountering the problem and tell you the exact culprit.

Upvotes: 1

Related Questions