• Uncategorized

    autoConfig=”false” effects

    My post on autoConfig triggered and interesting discussion with my colleague Cenk about which is the real effect of this setting; one of his customers asked what to do if they needed to adjust only one or two values and not all the ones discussed in Contention, poor performance, and deadlocks when you make Web service requests from ASP.NET applications, they wanted to be sure they could change only what they needed to fine tune and forget about the rest. The short answer is: you can change only what you need to and leave he rest as is, since we have default values hardcoded to improve performance so you’re safe (provided the values you’re changing make sense in the context, of course). If we have a look at System.Web.Configuration.ProcessModelSection with Windbg, we can see all the properties we have in <processModel> and _defaultValue corresponds to the defaults we have in machine.config.comments: 0:000> !do 06904868 Name: System.Web.Configuration.ProcessModelSection MethodTable: 6638dcb0 EEClass: 663a0604 Size: 64(0x40) bytes (C:\Windows\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll) Fields: MT Field Offset Type VT Attr Value Name 7910be50 400014d 30 System.Boolean 1 instance 0 _bDataToWrite 7910be50 400014e 31 System.Boolean 1 instance 0 _bModified 7910be50 400014f 32 System.Boolean 1 instance 1 _bReadOnly 7910be50 4000150 33…

  • Uncategorized

    Switch thread using the ThreadID

    Quick hint for today: how do you switch the thread you’re examining in Windbg? If you know the thread number you can type the command ~<thread number>s (e.g. ~21s to switch to thread 21). But what about if you only know the ThreadID (which is an hexadecimal value)? For example if you examine the output of the !lock command: 0:000> !locks CritSec mscorwks!ThreadpoolMgr::WorkerCriticalSection+0 at 7a393800 WaiterWoken No LockCount 21 RecursionCount 1 OwningThread 26a0 EntryCount 0 ContentionCount 15 *** Locked What thread is 26a0? Well… you can display all available threads (with the managed !sos.threads command or the native ~ [tilde] command) and then manually look for the ID, or use the following: 0:000> ~~[26a0]s eax=000057b4 ebx=00000000 ecx=79f40a2b edx=18926823 esi=000e194c edi=000006c4 eip=7c82ed54 esp=02d2fbf0 ebp=02d2fc2c iopl=0 nv up ei pl zr na pe nc cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000246 ntdll!KiFastSystemCallRet: 7c82ed54 c3 ret ~~[<threadID>]s (e.g. ~~[26a0]s), and with the sample above Windbg will switch to thread 21 ? Carlo Quote of the day: Knowledge is power, if you know it about the right person. – Ethel Mumford

  • Uncategorized

    And when you think there’s nothing left to do… you can still debug live

    There are circumstances where taking a dump is not possible or simply not convenient; imagine a situation where you’re hunting a nasty exception you don’t know where it comes from and you need to follow some complex steps to get there, or when you have dozens of that exception (let’s say an Access Violation) but you’re interested in a specific one you get only when on click on a specific button, or after you paginate long enough through a GridView (and of course you don’t want dozens of full dumps, 1 Gb each), or if you’re hunting for some security related problem and you need to inspect the security token your thread is using in a particular moment (something I did here) etc… For sure if you ask Doug he’ll have dozens of good answers to this question ? Getting started Let’s assume you already have correctly setup your Windbg workspace, symbols etc…, then you can go from File > Attach to a process… (or hit F6) to get the Attach to process dialog below: Note that if you expand the tree for your target process you’ll see some information about the process’ session, this is useful if for example…

  • Uncategorized

    aspnet_wp.exe can not be started. Code: 80070003

    This was a Windows 2000 server with ASP.NET 1.1 installed, and for some reason the customer was unable to start his web applications, he was getting "Server Application Unavailable" messages on the client. We found the Application event log full of entries like this one: Event Type:    Error Event Source:    ASP.NET 1.1.4322.0 Event Category:    None Event ID:    1084 Date:        18/02/2008 Time:        15.59.43 User:        N/A Computer:    <computername> Description: aspnet_wp.exe could not be started. The error code for the failure is 80070003. This error can be caused when the worker process account has insufficient rights to read the .NET Framework files. Please ensure that the .NET Framework is correctly installed and that the ACLs on the installation directory allow access to the configured account. The next logical step is to use Process Monitor to try to spot any "Access denied" errors, but there weren’t. Interestingly within the procmon trace we instead found quite a few entries similar to the following inetinfo.exe:1112 OPEN C:\Debuggers\cdb.exe PATH NOT FOUND inetinfo.exe:1112 QUERY INFORMATION C:\Debuggers\cdb.exe -server PATH NOT FOUND inetinfo.exe:1112 QUERY INFORMATION C:\Debuggers\cdb.exe -server.exe PATH NOT FOUND inetinfo.exe:1112 OPEN C:\Debuggers\cdb.exe -server PATH NOT FOUND inetinfo.exe:1112 QUERY INFORMATION C:\Debuggers\cdb.exe -server tcp:port=8090 PATH NOT FOUND inetinfo.exe:1112 QUERY INFORMATION C:\Debuggers\cdb.exe…

  • Uncategorized

    Need to print from a x64 machine? Can you wait 60 seconds?

    I guess some of you might have developed a web application which, among other functionalities, prints some kind of report; and sooner or later you might consider to move the application to a 64 bit machine. At this is what this customer did. They had this ASP.NET application which allows the user to run some queries on a backend database and then print the result on a network printer connected to the web server; under some circumstances the application was hanging for 60 seconds (always 60 seconds) before timing out; of course everything was running fine on a 32 bit machine (i.e. we never managed to reproduce the issue there). At the beginning we thought to some kind of network timeout on the customer’s network or a configuration problem on the server (the application is quite complex so was not possible to have a repro to run and debug on my machine), and this was partially confirmed by a hang dump which showed some error messages about the printer, but this was not consistent enough to get a clue. What was consistent was the use of winspool.dll ntdll!NtDelayExecution(void)+0x15 kernel32!SleepEx(unsigned long dwMilliseconds = 0x3e8, int bAlertable = 0)+0x68 kernel32!Sleep(unsigned long dwMilliseconds…

  • Uncategorized

    Don’t let IE local cache drive you crazy!

    I stumbled across this issue multiple times during my life of web developer (which begun about 10 years ago), it appeared every now and then to complicate things when I was in the middle of a heavy debugging sessions and doing frequent changes to my pages; I was expecting some kind of results but despite the fact that the code was looking good, there were no signs of those changes. Sometimes even adding a new UI element like a button or an image or changing the color of a header had no effect… ? Having a look at the page source within IE demonstrated the browser was somehow right not showing the new image or color because it was not there in the code… where was that source coming from? ? Well, if it does not come from the web server, then it’s loaded from the IE local cache… so let’s go to Internet Options > General > Delete > Temporary Internet Files, give it another try and guess what? This time it works…! So, not sure why, but for some reason IE was not refreshing its case and was using an outdated version of my pages. Then after a…

  • Uncategorized

    .NET Runtime 2.0 Error, Event id:5000

    This error message was reported by a customer last week; every day, randomly, his application pools (on two servers in NLB) were restarted during business hours without an apparent reason, and of course users were complaining because of lost sessions etc…; the following entry was added to the Application event log: Event Type: Error Event Source: .NET Runtime 2.0 Error Reporting Event Category: None Event ID: 5000 Date: 9/28/2005 Time: 3:18:02 PM User: N/A Computer: IIS-SERVER Description: EventType clr20r3, P1 w3wp.exe, P2 6.0.3790.1830, P3 42435be1, P4 app_web_7437ep-9, P5 0.0.0.0, P6 433b1670, P7 9, P8 a, P9 system.exception, P10 NIL The first thing to do when we have a specific error message is to search the Knowledge Base for known issues/hotfixes etc…, and was quite easy to find the article Unhandled exceptions cause ASP.NET-based applications to unexpectedly quit in the .NET Framework 2.0 which I already used more than once in the past to resolve similar issues; I usually suggest the customer to first apply the solution described in “Method 2”: Method 2 Change the unhandled exception policy back to the default behavior that occurs in the .NET Framework 1.1 and in the .NET Framework 1.0. Note We do not recommend…

  • Uncategorized

    Take control over Windbg

    If you’re like me and most of my colleagues in Customer Service and Support, you’ll probably spend a good deal of time in your debugger, which for me is WinDbg. So, since I’m in love with keyboard shortcuts (a colleague of mine likes kidding me stealing my mouse since I hardly use it, and every now and then uses me as his personal “shortcut reference” ?) and always searching for “productivity tips” to optimize my workflow. Windbg has a few of them, here is what I use. Automate WinDbg startup I first discovered this in this post from Tess and then customized it to match my needs, especially on my Vista x64 machine; basically this is a .reg file set WinDbg as the default application for .dmp files, and adds a few entries to the right click menu to chose different options. I also have to say that on my x64 machine I actually have two separate folders for WinDbg 32bit and 64bit, so that depending on the dump I’m debugging I can use the right tool: Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\.dmp] @="Debugger.Dump" [HKEY_CLASSES_ROOT\Debugger.Dump\DefaultIcon] @="c:\\debuggers x86\\cdb.exe" [HKEY_CLASSES_ROOT\Debugger.Dump\Shell\Debug_1_1_x86] @="Debug This Dump for .NET 1.1 x86" [HKEY_CLASSES_ROOT\Debugger.Dump\Shell\Debug_1_1_x86\Command] @="\"C:\\debuggers x86\\windbg\" -z \"%1\"…

  • Uncategorized

    Ok, now how do I capture my dump?

    Now we know how it started, some basic information and terminology and why symbols are important, it’s now time to capture our first dump. How? When? Using which tool? It depends… ? From the second post of this series we already know the difference between a hang and a crash dump and depending on the problem we are troubleshooting we know which one we need. There are different ways to capture such a dump but the most used tool in CSS is adplus, and specifically in the IIS and Internet Development team (which I belong to, by the way ?) we also use DebugDiag. I personally prefer adplus, I like it to be run at the command line and be highly configurable through its .cfg files, but there are circumstances (especially unmanaged memory leaks and hanging web applications where the customer can’t be always monitoring the server to readily capture a manual hang dump with adplus) where I find DebugDiag quite useful. Let’s see the differences. Adplus.vbs Adplus is essentially a VBScript (quite large, more than 5.000 lines) file which helps you capture a dump and it accepts some arguments at the command line (or it’s also possible to use…

  • Uncategorized

    Why should we care about symbols?

    I already touched this topic a while ago, but since it’s an important part of the debugging process (and your debugging techniques may vary a lot, depending if you have or not good symbols for your dump) I though would be a good idea to give some more details. And just to jump start on the topic, here’s something I learnt a while ago after wasting a few hours typing commands and looking at inconsistent results… debugging with the wrong symbols could be much worse than debugging with no symbols at all. What are symbols? You can think of symbol files basically as small databases, files which contain source line information, data types, variables, functions and everything else needed to provide names for all lines of code, instead of hexadecimal addresses. They usually have .pdb (or .dbg) extension, and are matched with the actual executable code using an internal timestamp, so it’s very important to generate symbols every time you build the application, also for release builds. If you’ll ever have a problem with your live application and you’ll need to debug it, and if you’ll not have the matching symbols (matching means the symbols obtained from the same exact…