If broken it is, fix it you should

Using the powers of the debugger to solve the problems of the world - and a bag of chips    by Tess Ferrandez, ASP.NET Escalation Engineer (Microsoft)

Posts
  • If broken it is, fix it you should

    ASP.NET Quiz Answers: Does Page.Cache leak memory?

    • 14 Comments
    A few days ago I posted a question I had gotten on email (look here for complete post): " We use Page.Cache to store temporary data, but we have recently discovered that it causes high memory consumption. The bad thing is that the memory never goes down even though the cache items have expired, and we suspect a possible memory leak in its implementation. We have created this simple page: protected void Page_Load(object sender, EventArgs e){ this.Page.Cache.Add(Guid.NewGuid().ToString...
  • If broken it is, fix it you should

    ASP.NET Quiz - Does Page.Cache leak memory?

    • 30 Comments
    Yesterday I received an email from a blog reader about caching and memory leaks… Paraphrasing freely it went something like this: We use Page.Cache to store temporary data, but we have recently discovered that it causes high memory consumption. The bad thing is that the memory never goes down even though the cache items have expired, and we suspect a possible memory leak in its implementation. We have created this simple page: protected void Page_Load( object sender, EventArgs...
  • If broken it is, fix it you should

    ASP.NET Case Study: Lost session variables and appdomain recycles

    • 108 Comments
    Last night I got a question from one of the readers of the blog that went like this: “We are facing a problem that i cannot understand, every now and than i see that my app domain is recycled (i have a log in the application_end), I check the IIS logs and i don't see a restart of IIS and i know that no one is changing configuration (web.config). I wanted to know if you know of any way that i can pinpoint the reason for that app domain to die? The application pool that i am using...
  • If broken it is, fix it you should

    ASP.NET Case Study: High CPU in GC - Large objects and high allocation rates

    • 24 Comments
    Rather than spending a lot of time on explaining the details of the garbage collector, I'll refer you to Maoni's blog for some very interesting reading, but in this case study I want to show you how to get to the bottom of a problem with high CPU in the garbage collector. Problem description: At times the application will be very slow to respond and the CPU usage is very high (70-80%). Troubleshooting steps: I have already tipped you off in the title that the issue will be High CPU in...
  • If broken it is, fix it you should

    .Net exceptions - Tracking down where in the code the exceptions occurred

    • 21 Comments
    I have written earlier about how to track down exceptions using configuration scripts for adplus. Most of the time the methods are short enough that just knowing what function you got an exception in, is enough for you to track down the why, but we all know that we don't live in that perfect world where we write completely modular applications and everything is nicely lined up:) Let's say you have found this exception on the heap... 0:025> !dumpobj 02b7191c Name: System.NullReferenceException...
  • If broken it is, fix it you should

    ASP.NET 2.0 Crash case study: Unhandled exceptions

    • 84 Comments
    For a long time all my case studies have been on 1.1. it’s time to venture out in 2.0 land and look at what may seem like a 2.0 specific issue. I say “may seem” because this case study will only directly crash if you are using 2.0, but as you’ll learn later the problem existed in 1.1 and 1.0, it was just way harder to track down. Problem description: Once in a while ASP.NET crashes and we see events in the system event log like this one Event Type: Warning Event Source: W3SVC...
  • If broken it is, fix it you should

    ASP.NET Memory: If your application is in production… then why is debug=true

    • 86 Comments
    Statement “Ensure that the debug="false" on the <compilation> element in the web.config file of each and every ASP.NET application on the server. The default during development is "true" and it is a common mistake to allow this development time setting to find its way onto production servers during deployment. You don't need it set to true in production and it often leads to memory overhead and inefficiencies.” What problems does leaving debug=true cause? There are three main...
  • If broken it is, fix it you should

    ASP.NET: Strong named assemblies should not be stored in the bin directory

    • 21 Comments
    Statement “In ASP.NET 1.1, do not deploy strong named assemblies to the BIN directory (i.e. if they are strong named make sure you DO put them in the GAC).” What problems do storing strong named assemblies in the bin directories cause? In ASP.NET 1.1, strong named assemblies are loaded as “domain neutral”. As you probably already know every asp.net application lives in its own application domain (a unit of isolation inside an application), and assemblies used by this application...
  • If broken it is, fix it you should

    ASP.NET Memory: You use the same dll in multiple applications, is it really necessary to load it multiple times?

    • 6 Comments
    Statement “Wherever possible strong name and install to the global assembly cache (GAC) any assemblies that are used by more than one ASP.NET application. This will reduce memory consumption.” What problems do storing common assemblies in the bin directories cause? Let’s say you host an e-commerce site and you have group of dlls for common tasks such as verifying user information, perhaps some special grid control, shopping cart, some business rules dlls etc. and you have ten different...
  • If broken it is, fix it you should

    ASP.NET: Check your Web Site today for these common assembly related memory and perf issues

    • 3 Comments
    Recently my colleague Doug wrote a nice post on Nine tips for a healthy "in production" ASP.NET application . I have been planning to post about some of these for a while, so I decided to steal some of his points and expand a bit on them, and also show you how you can identify them in a memory dump. As most of you know I like to go into great detail about things J so to make it a bit more manageable I have divided my posts up into 3 different parts (one per statement that Doug makes in...
  • If broken it is, fix it you should

    .Net memory leak: Unblock my finalizer

    • 44 Comments
    This time I figured I'd talk about an issue that spans all three debugging scenarios, hangs, memory issues and crashes... yummy:) But first off let me just share a link i found on Mike Stall's debugging blog , the source for .net 2.0 (rotor). Very handy if you want to take a closer look at how things are implemented in the framework. Edit 2010-03-08: Changed the link to the download for the CLI source Problem statement: The application runs fine for hours on end, then suddenly memory...
  • If broken it is, fix it you should

    It's been a while

    • 7 Comments
    Hi All, It has been a while since my last post, I've been visiting with my friends in my old hometown of Charlotte, NC. And then I've been down with the flu for a while, but I have some posts lined up so I'll be writing up some new scenarios in the next few days. Until then, Tess
  • If broken it is, fix it you should

    ASP.NET Performance Case Study: Web Service calls taking forever

    • 30 Comments
    This issue has been pretty frequent since .net came out, and I am bringing it up for two reasons. It is something I think every web developer calling web services should be aware of... and It is a good example of how the product changes based on feedback from support incidents etc. to better suit our customers Problem Description We have an ASP.NET application acting as a GUI to our middle tier (Web Service) and at peak times the application is dead slow. Requests start timing out...
  • If broken it is, fix it you should

    .NET Memory Leak: XmlSerializing your way to a Memory Leak

    • 60 Comments
    I hate to give away the resolution in the title of the blog since it takes away a lot of the suspense:) but I can't figure out a better way to name the blog posts and still keep them nicely searcheable so here we go... This one has come up a number of times, in fact so many that I finally wrote a kb article on it a couple of years ago. I'll give you the link at the bottom of the blog post. I specifically remember one time when I had a case on this. It was a Saturday at 2 am and this customer...
  • If broken it is, fix it you should

    .NET Crash: Managed Heap Corruption calling unmanaged code

    • 2 Comments
    If someone asked me, what is the nastiest types of issues you get? I would say managed heap corruption, closely followed by native heap corruption. Btw, if you are new to debugging .net issues with windbg this case study might not be the best one to start with. This is about as hard as it gets when debugging .net issues, so take a stroll through my other posts first. Ok, you’re still here:) let’s see how we tackle this one… Problem description Once in a while, completely randomly the...
  • If broken it is, fix it you should

    A .NET Crash: How not to write a global exception handler

    • 10 Comments
    I’ve written quite a few posts on memory issues because that is the type of problem we get most frequently in support, but I thought I’d break it up a little bit with a post on a crash scenario. This is a problem that I have seen a number of times in cases throughout the years and it also turns out to be a pretty nice sample for showing how to debug a stackoverflow crash in .net. Problem description From time to time ASP.NET crashes with the following event in the eventlog: Event Type: Warning...
  • If broken it is, fix it you should

    .NET in SQL Server 2005 – Making .net code more reliable

    • 0 Comments
    A while back I got interested in the new .net/CLR features in SQL Server 2005 such as .net stored procedures, functions, triggers etc. First off let me just say that the extent of my knowledge about databases is pretty much limited to “select * from authors” so I have to admit that my interest was triggered mostly by the fact that I wanted to know how we were going to debug it J I started off as I usually do by taking a simple sample and then modifying it to the point where it would generate...
  • If broken it is, fix it you should

    .NET Memory: My object is not rooted, why wasn't it garbage collected?

    • 20 Comments
    I got a comment on one of the posts asking this question and I started writing a comment-answer but it turned into a long-winded rant so I decided to blog it instead:) So you're looking at a dump and run !gcroot on your object but it doesn't find a root. Then why is it still around on the heap... There are many reasons for this but the short answer is: It was still alive (rooted) last time a garbage collection for that specific generation was run. This is not completely true... it could...
  • If broken it is, fix it you should

    ASP.NET Memory Leak Case Study: Sessions Sessions Sessions…

    • 28 Comments
    In ASP.NET 1.1 as you probably know, there are 3 different locations to store session objects. In proc which stores session variables in the cache, State server which stores it in the state service and finally SQL Server . There are of course pros and cons of each but no matter which one you use, you should be careful with how much you store in session state if you want your application to be scalable. For in-proc session state, storing too much in session means high memory usage. For state...
  • If broken it is, fix it you should

    Contacting Tess...

    I have been receiving a lot of email lately asking for help on particular issues. Unfortunately I can not give attention to individual issues as I am posting to this blog in my own free time or on the rare occasions that slots of time open during my workday. I hate to say no, it's not really in my nature:) but I have to, so I would ask you kindly to go through our official channels for getting support at http://support.microsoft.com if you need more in-depth help on an issue, and you will get...
  • If broken it is, fix it you should

    A bag of chips – Math stuff… and books…

    • 3 Comments
    This is a completely off topic post but I added the “–and a bag of chips” to the blog description to allow myself to write these:) I just came across an article about teaching binary to 3rd graders , through something called the Socratic method, and it’s just an amazing read. Hmm… wonder if I can apply this on my 3 year old daughter:) As you probably could have guessed I have a special place in my heart for pure mathematics (proofs, deduction etc.). It sorta goes hand in hand with debugging...
  • If broken it is, fix it you should

    ASP.NET Memory - How much are you caching? + an example of .foreach

    • 19 Comments
    I was writing a post on debugging a high memory usage problem caused by storing too much in session scope, but I realized I got in to tangent discussions all the time so I decided to create a separate post on caching first. Caching is by far the most common cause of high memory problems. It’s an understatement to say that the cache is often overused. As with everything else nothing comes for free, so the performance you gain by storing items in cache has to be compared to the performance you...
  • If broken it is, fix it you should

    .NET Memory Leak Case Study: The Event Handlers That Made The Memory Baloon

    • 45 Comments
    It always feels like issues come in clusters. One week we get tones of cache related cases, next week everyone is stuck in some lock and so on. Lately I have had a number of issues where there were memory leaks related to event handlers. Problem description We have a pretty easy to repro memory leak, even with very few users memory grows at a high rate and the memory is never released. The usual suspects are eliminated, i.e. we know that the app doesn’t cache much or store much or anything...
  • If broken it is, fix it you should

    Request for feedback

    • 34 Comments
    Not sure if anyone is reading this blog, but if you are and there is something specific you want me to blog about please let me know. On my TODO list right now i have Debugging managed memory leaks Automating debugging with .shell and .foreach etc. Debugging .net 2.0 applications but I want this blog to be a useful resource, so rather than just blogging about what interests me, let me know what interests you:). And I'm also interested in getting feedback on if my blog posts are...
  • If broken it is, fix it you should

    Debugging Tips: Use windbg as a calculator, a chat client and more…

    • 4 Comments
    Yes, you read it right… it’s not only a debugger, for only $19.95 extra, we’ll throw in a free calculator and chat client:) and you can even run applications from windbg’s command prompt. Calculator Jokes aside, not even I would open up windbg only for the purposes of doing calculations, but when you are debugging and need to do some simple conversions from hex to decimal, and some integer calculations you don’t have to switch to calc.exe, you can just use windbg’s expression evaluator. ...
Page 10 of 11 (261 items) «7891011