Managed ThreadPool vs Win32 ThreadPool (pre-Vista)

The following is a conversation between me and a CLR dev. The conversation is very informative so I quote it here. From:  Sent: To: Subject: RE: ThreadPool.QueueUserWorkItem   There might be some confusion here around the meaning of the term “I/O Thread.”  In the Windows thread pool (the old one, not the new Vista thread…

5

Managed Watson Dump

From .Net Framework 2.0, Dr. Watson is able to generate dump compatible with .Net framework. This means, dumps with heap data generated by Dr. Watson contains information about managed heap so they can be analyzed with sos.dll. Some update to Dr.Watson is necessary to make this happen. Dumps generated by older Dr.Watson is not compatible with…

1

Inspect a 32 bit Process Dump Generated by a 64 bit Debugger

64 bit Windows can run both 32 bit process and 64 bit process. For debugging though, you want to use 32 bit debugger to debug 32 bit process, and 64 bit debugger for 64 bit process. Otherwise it won’t be pretty. Occasionally, I receive a 32 bit process dump generated by a 64 bit debugger….

2

Getting a Full Memory Dump for a Process

To diagnose a problem for a remote customer, sometimes the easiest way is to have the customer generate a full memory dump for the process, and share the memory dump. In Vista, task manager can generate a full memory dump from the Processes tab. In Windows XP , this functionality does not exist. However, Windows…


Event Handles “leak”

On our stress run, we saw our process’ handle count steadily increases until certain point, then it stabilizes. However the number of handles is high. Most of those handles are Event handles. We are concerned about it. So we went off and did some investigation. Turns out the Event handles are coming from the use…

3

Use !htrace to debug handle leak

Windbg Debugger’s !htrace extension is very handy to debug handle leak. The process essentially boils down to the following simple steps: 1.       Enable trace 2.       Take a snapshot 3.       Run scenario 4.       Show the diff On step 4, !htrace will show all the extra opened handles after the last snapshot, along with the callstack if…

3

Consider Creating a new class for locking

C# provides keyword lock for synchronized access.   A good practice is to create a private object for locking purpose. For example, public class LockExample {     private object syncObject = new object();       public void SynchronizedMethod()     {         lock (syncObject)         {         } }} It may make sense to create a…

5

A case study of a NullReferenceException

We are seeing a NullReferenceException in our stress program. The investigation process may be helpful to some folks.   Thread 22 is showing a Watson dialog.   This is a register corruption.   0:022> kp ChildEBP RetAddr  091bc9a0 76961220 ntdll!ZwWaitForSingleObject(void)+0x15 091bca10 76961188 kernel32!WaitForSingleObjectEx(void * hHandle = 0x00001034, unsigned long dwMilliseconds = 0x4e20, int bAlertable =…

3

App Config’s root element should be namespace-less

The root element for Application config file is <configuration> <?xml version="1.0" encoding="utf-8" ?> <configuration > </configuration> The application config file is shared with CLR and Windows SxS. SxS dictates that the root element is <configuration>, and it should be without namespace. If the application config file does not follow the rule, SxS will refuse to…


Getting the right exception context from a memory dump

When debug a memory dump, the dump may not in the right exception context when it is first loaded in the debugger. However, we can figure out the right context from the dump. Let’s load the dump. c:\debuggers>cdb -z c:\temp\foo.dmp Symbol search path is: *** Invalid ******************************************************************************** Symbol loading may be unreliable without a symbol…

1