Rahul Soni's blog

Never assume the obvious is true!

How to repro Server Too Busy Errors?

How to repro Server Too Busy Errors?

  • Comments 4

Well, before doing anything like this, PLEASE ensure that you are working on a Demo box. I am working on Win 2003 which is my Development box and I can bear the impact of that error message.

The first question is WHY would you like to Repro an error message like this?
I wanted to do this because I wanted to know which sepecific key to modify in my Metabase/Registry/IIS GUI so that I could get 500.13 (Server Too Busy) error. After that, I wanted to set a Custom Error page so that whenever that error message appears, the client gets the Custom Error. To check whether my Custom Error page is working, I needed to repro the issue. That is WHY!! :o) Apart from that, knowing which metabase key can cause which issue never hurts!!

The second question is HOW to repro it WITHOUT any kind of stress tool?
The answer is - AspRequestQueueMax key in the metabase.

Okay, I will not be documenting what exactly it does because we have tonnes of documentation for that. The one which I really like is this. Search for ASP Server Too Busy Error and you will get a decent documentation on not only what it does, but also some good practices!

So, first of all we need to create a read bad ASP page which will take a lot of time and could cause your IIS Server to hang (because w3wp.exe will be at 100%). Since I have two PCs it was not a concern for me. But remember, if you are working on just one PC, you need to modify the code accordingly with a smaller loop variable.

Lets begin by creating a page called Bad_Code.asp. Open it with Notepad and paste the following code.

<%
  Server.ScriptTimeout = 30000
  Response.write(now())
  str= "abc"
  for i= 1 to 100000
    str = str & i
  next
  response.write(str)
%>

Before browsing this page, you will need to set the AspRequestQueueMax key to 1. By default it is 3000. We are telling HTTP.SYS to throw the 500.13 error as soon as the second request gets Queued, so that we don't need to stress IIS (our bad_code.asp page is good enough to do that ;o) !!

Follow the steps to change the value and remember to create a backup of the Metabase before doing any changes (just in case!).

1. Open Internet Information Services, and right-click on the Root (local computer) node.
2. Click on Properties, and ensure "Enable Direct Metabase Edit" is checked.
3. Open C:\WinNT\System32\inetsrv\Metabase.xml in notepad.
4. Search for AspRequestQueueMax and set the value to 1
5. Save the file and Reset IIS. (Start -> Run -> IISReset and click OK)

Now, to reproduce the issue go to the client machine and browse the page from an Internet Explorer window. (say - http://MACHINENAME/ServerBusy/bad_code.asp). You will see that the IE will try getting the data from the server. Leave that instance of IE alone and open a new IE instance. Browse the same page again, you should be able to see the "Sever too Busy" error message :o)

The thing to note here is that, the previous IE will still be trying to load the page (and eventually it will!!). Now, all is required is to set the Custom Error page and you can test that quite simply by reproducing this error message using just two IE windows. Please ensure that "Show friendly HTTP error messages" is unchecked in your IE's Advanced Internet Option settings. Also, don't forget to change the default value back to 3000 for AspRequestQueueMax!

Cheers,
Rahul

  • Imho a better way to reproduce these kind of errors you could create a ASP.NET web site and a custom Http module that hooks on one of the events of the HTTP Request Pipeline and just change the status code of the response.
  • Agreed! The reason I have posted it is because it won't be applicable in the classic ASP scenario and its simplicity. Believe me, there are still quite a lot of folks out there using classic ASP.

    And that said, I completely agree with your point of HTTP Module for ASP.NET websites :o)
  • Another way to add httpruntime in the web.config file e.g.

    <httpRuntime executionTimeout="seconds"

                maxRequestLength="kbytes"

                minFreeThreads="numberOfThreads"

                minLocalRequestFreeThreads="numberOfThreads"

                appRequestQueueLimit="numberOfRequests"

                useFullyQualifiedRedirectUrl="true|false"  />

  • so how did you modify the standard ASP 500.13 page?

    we need to do the same thing.

Page 1 of 1 (4 items)
Leave a Comment
  • Please add 2 and 7 and type the answer here:
  • Post