« Previous Next »

Thread: Dynamic Compression and Response.Close Bug

Last post 06-10-2009 12:36 PM by anilr. 6 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (7 items)

Sort Posts:

  • 09-29-2008, 5:07 PM

    Dynamic Compression and Response.Close Bug

    It seems like IIS7 has a bug where if dynamic compression is enabled and you do a Response.Close() the last character of the response stream gets stripped off.

    To test it just enabled dynamic compression in IIS7 and create a page with the following Page_Load method:

        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Write("test");
            Response.Flush();
            Response.Close();
        }

    You should notice that the last "t" in the word "test" is missing when you display the page in a web browser. Disabling dynamic compression or commenting out "Response.Close()" eliminates the bug. If anyone has another work around or knows if this is truly a bug I would appreciate any feedback. Thanks.

  • 10-03-2008, 4:54 PM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 10:13 PM
    • Redmond, WA
    • Posts 2,247

    Re: Dynamic Compression and Response.Close Bug

    Response.Close sends a reset packet to the client and using it in anything other than error condition will lead to all sorts of problems - eg, if you are talking to a client with enough latency, the reset packet can cause any other response data buffered on the server, client or somewhere in between to be dropped.

    In this particular case, compression involves looking for common patterns within the response and some amount of response has to be buffered by the compression code to increase the chance of finding longer repeating patterns - this part that is buffered cannot be sent to the client once you do Response.Close().

    In short, do not use Response.Close().

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
  • 03-23-2009, 12:08 AM In reply to

    • espresso
    • Not Ranked
    • Joined on 09-24-2008, 4:04 AM
    • Posts 8

    Re: Dynamic Compression and Response.Close Bug

     Ok, then what DO you  use?  Recently I was getting timeout errors when making a bunch of API calls one right after the other.  Until I put in response.Close() I was getting that timeout error after only the 3rd SOAP API call.

  • 03-23-2009, 12:10 AM In reply to

    • espresso
    • Not Ranked
    • Joined on 09-24-2008, 4:04 AM
    • Posts 8

    Re: Dynamic Compression and Response.Close Bug

    Ok then what DO you use?  I had to put in response.Close or else I kept getting a timeout error right after request.GetRequestStream() in my code during a bunch of bulk API calls..one right after the other.  On the first two API calls I made, they were fine.  It was always on that 3rd API call I got a timeout error until I put response.Close() in there.
  • 03-26-2009, 6:41 PM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 10:13 PM
    • Redmond, WA
    • Posts 2,247

    Re: Dynamic Compression and Response.Close Bug

    It is not clear what issue you were hitting - was the timeout at the client or the server side?  Resetting the connection to avoid a timeout seems like a band-aid and seems like you still have some bad problems lurking.  Can you collect "failed request tracing" for the request sequence resulting in a timeout?

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
  • 06-09-2009, 7:46 PM In reply to

    • SeanH
    • Not Ranked
    • Joined on 06-09-2009, 11:41 PM
    • Posts 1

    Re: Dynamic Compression and Response.Close Bug

    I found Replacing Response.Flush(); Response.Close(); With Response.End(); Resolved a similar issue with dynamic compression for me.

  • 06-10-2009, 12:36 PM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 10:13 PM
    • Redmond, WA
    • Posts 2,247

    Re: Dynamic Compression and Response.Close Bug

    HttpApplication.CompleteRequest is the better one to use rather than Response.End - the latter results in a exception being raised which is going to cause performance problems, especially on x64.

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
Page 1 of 1 (7 items)