• Uncategorized

    Find folder size (conditionally) with LogParser

    I was reading this post from Rahul a few days ago, and wondered if something similar could have been done (hopefully with less efforts) with LogParser… Well, it turned our that LogParser accepts a “-FS” switch which stands for File System as the input type, and if you run “logparser -h examples” you’ll have a few sample commands you can use as the basis of your scripts. And guess what? Here’s one of them: Print the 10 largest files on the C: drive: LogParser “SELECT TOP 10 * FROM C:\*.* ORDER BY Size DESC” -i:FS I created a similar structure and put in there some sample images, just to have some files to count: So… here’s the script: logparser “SELECT SUM(Size) FROM c:\temp\Rahul\*.* WHERE INDEX_OF(Path, ‘_wow’) > 0” -i:FS And the output: 5 images, 35.391 bytes each = 179.655 bytes… here we are! ? Carlo Quote of the Day: It is a great thing to start life with a small number of really good books which are your very own. –Sir Arthur Conan Doyle

  • Uncategorized

    Start to play with LogParser

    A few months ago (back at the beginning of March) at the annual offsite meeting my virtual team had in Lisbon, my colleague Doug held an hour session about LogParser and some of the cool features it has. Doug promised to blog about it with more details, so I don’t want to steal him an argument (and he for sure knows more than me on the subject), but I started play with it to analyze some logs I had, and among the others I wrote a couple of scripts to automate some tasks I previously had to do manually, and just wanted to share with you (and post on my blog as a future reference). So, here’s the deal: you may know from Tess, strong named assemblies should not be deployed in the /bin folder; and if you ever had to troubleshoot a managed memory leak, you probably know that if you have an assembly which is loaded multiple times in memory because you deployed it in the /bin folder of every application you have, it’s a good idea to install it in the GAC to avoid wasting server resources. So far so good, but how to find those assemblies?…

  • Uncategorized

    Free Download Manager

    As I did in a previous post, here is another nice tool I’ve been using for a few weeks now, which I find very helpful when it comes to large downloads such as the recently released Visual Studio 2008 beta 2 (but now I’m using it for every download larger than 5 Mb): Free Download Manager. I short, FDM allows you to resume your interrupted downloads (if the server supports it, of course), limit the downloading speed (handy if you’re browsing the Internet while downloading in background), schedule your downloads and perform some actions when done (scan for viruses, suspend/shutdown the computer, close the connection etc…), find and use mirror servers, split the download into several section to increase download speed (they say up to 600%: I’ve not measured it, but for sure it’s faster), html spider, download entire sites etc… (here are some screenshots). The idea is not new (GetRight for instance does almost the same), up to you decide what you like most ? Carlo Quote of the Day: Nature has given to us the seeds of knowledge, not knowledge itself. –Lucius Annæus Seneca

  • Uncategorized

    I have an OutOfMemory exception in my dump! Am I leaking memory?

    Well… the short answer is: not necessarily ? I had this discussion a few days ago with a customer who called CSS for a crash they were having, and since he was also starting to learn some debugging and dump analysis basics, he was interested to have some deeper details about my findings in the crash dump they sent in. In particular, he thought the crash was due so an OutOfMemoryException because checking the exceptions with WinDBG, he saw something like the following: 0:000> !dumpallexceptions Going to dump the .NET Exceptions found in the heap. Number of exceptions of this type:        1 Exception 0cf500bc in MT 79b94ee4: System.ExecutionEngineException —————– Number of exceptions of this type:        1 Exception 0cf5007c in MT 79b94dac: System.StackOverflowException —————– Number of exceptions of this type:        1 Exception 0cf5003c in MT 79b94c74: System.OutOfMemoryException —————– The point is that we are pre-loading a few exception objects on the heap when starting an AppDomain, and the reason is quite simple if you think about it for a moment. Let’s pretend we don’t have exception objects preloaded: if an application ever reaches a condition where needs to allocate some more memory but there is not enough memory available, then the…

  • Uncategorized

    Server Error 500, unable to create new session

    I saw this problem reported on a Windows 2000 Server (IIS 5.0), I’ve not checked if the same could also happen on IIS 6/7… The application is build on classic ASP pages and the error appeared about once per day on a test server; when browsing the user got a message reading "unable to create new session" (rough translation from Italian), and when this happens the only solution was to reset IIS (while in that status, even static HTML content was not served). Interestingly the Event Log showed quite a few entries like the following: Event Type:  Warning Event Source: COM+ Event Category: Activation Event ID:    4238 Date:        03/07/2007 Time:        11.05.49 User:        N/A Computer:    xxxxxxxx Description: COM+ has determined that your machine is running very low on available memory.  In order to ensure proper system behavior, the activation of the component has been refused.  If this problem continues, either install more memory or increase the size of your paging file.  Memory statistics are: dwMemoryLoad = 98 dwTotalPhys = 536358912 dwAvailPhys = 9453568 dwTotalPageFile = 1945448448 dwAvailPageFile = 48668672 dwTotalVirtual = 2147352576 dwAvailVirtual = 405975040 Server Application ID: {3D14228D-FBE1-11D0-995D-00C04FD919C1} Server Application Name: IIS Out-Of-Process Pooled Applications This turned out to be…

  • Uncategorized

    Visual Studio debugger conflicts on port 80

    I personally got this problem on my laptop a while ago where IIS and Skype where involved, and even if this time the customer reported two different applications involved (Visual Studio 2005 and Cisco IP Communicator), the symptoms where the same: with Visual Studio 2005 and Cisco IP Communicator running ad the same time, he was unable to debug his web application with the message “Unable to start debugging on the web server.  Could not start ASP.NET or ATL Server debugging.  Verify that ASP.NET or ATL Server is correctly installed on the server“. If he stopped the IP Communicator the problem went away; clearly a conflict between IIS and Cisco Communicator. Just to be sure we had a look at “netstat -a -b”, and found (as expected) that both applications were listening on the HTTP port TCP    computername:http     computername.domain.com:0  LISTENING       492 [inetinfo.exe] TCP    computername:http     computername.domain.com:0  LISTENING       3872 [Communicator.exe] Since I don’t know how Cisco IP Communicator works (and we can’t support third party apps anyway), we decided to change the IIS port to 81, but this time the customer was getting “Unable to start debugging on the web server. Unable to connect to the web server. Verify that the web…

  • Uncategorized

    Driver’s SQLAllocHandle on SQL_HANDLE_DBC failed

    Another weird one I got this afternoon. A colleague from the Sql team asked my help about what looked an authentication problem is customer’s web application, while trying to connect to a Lotus Notes database: in short, the customer was developing his application with Visual Studio 2005 and was testing it with Cassini, and everything looked fine, but as you can guess the problem arose when he deployed the site on his test IIS. They got the error [IM005] Driver’s SQLAllocHandle on SQL_HANDLE_DBC failed. The first thought was about a permission problem, since as you may know one of the main differences between IIS and Cassini is that the latter is essentially a process which runs in the context of the account logged on the machine, while IIS is a service which runs under different accounts but with lower privileges. Ok then, to verify this hypotheses we made a quick change to the <processModel> section to have the worker process running under the customer’s account instead of the default ASPNET (he was testing on his local IIS 5.1 on XP). Well… same problem. So that could not be a security problem, ASP.NET was running as an administrator… ? The error…

  • Uncategorized

    Unable to “InitializeSecurityContext”?

    Sometimes having fortune at your side can really save you the day (to say the least), and in developer support it can save you hours (of not days) of troubleshooting… With this premise, a couple of weeks ago I was helping a colleague from the Sql Server support team whom was struggling with an authentication problem one of his customers was having with Reporting Services: basically IIS was prompting them to login to access the application, but even entering the correct credentials those were refused, and after three strikes they were redirected to the standard 401 (unauthorized) page. While waiting for some logs I requested to the customer, I was building a repro for another customer I had at the same time (with a completely different problem, that was a weird runtime exception I’ll likely write about in another post), and one of the requisites was to have the application pool running under a domain account instead of the default NETWORK SERVICE: well… I got the same problem reported by the first customer! ?  It worth mentioning that I was also using Integrated Authentication for the virtual directory, and interestingly, the problem disappeared if I was using a local account…