[Mono-bugs] [Bug 419730] New: HttpWebRequest. CheckFinalStatus sometimes hangs and results in read timeout

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Aug 22 16:19:48 EDT 2008


           Summary: HttpWebRequest.CheckFinalStatus sometimes hangs and
                    results in read timeout
           Product: Mono: Class Libraries
           Version: 2.0
          Platform: i686
        OS/Version: openSUSE 10.3
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.Core
        AssignedTo: jbevain at novell.com
        ReportedBy: awhite at ipswitch.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Community User

Found this when reading from Amazon's S3 Web Service.  Reading a S3 bucket that
does exist works fine, but a bucket that does not exist causes the hang and
then read timeout.

Code to reproduce:

using System;
using System.IO;
using System.Net;
using System.Text;

namespace Test404
        class MainClass
                public static void Main(string[] args)
                        HttpWebRequest req =
                        req.Method = "GET";
                        req.AllowWriteStreamBuffering = false;
                        req.KeepAlive = true;

                        HttpWebResponse resp;

                                resp = (HttpWebResponse)req.GetResponse();
                        catch (System.Net.WebException ex)
                                Console.WriteLine("ex :"+ex);
                                resp = (HttpWebResponse)ex.Response;            




I tracked the issue down to HttpWebRequest.CheckFinalStatus.  I cannot say if
this is the "correct" solution but it may give a hint about what was happening. 

if ((int) code >= 400) {
        string err = String.Format ("The remote server returned an error: ({0})
            (int) code, webResponse.StatusDescription);

        throwMe = new WebException (err, null, protoError, webResponse);

        // webResponse.ReadAll ();

        if (resp != null)
                resp.ReadAll ();

by replacing webResponse.ReadAll (); with resp.ReadAll (); my S3 example
worked.  For what that's worth.

btw - there is another webResponse.ReadAll ();  a few lines down that may also
need replacing/reviewing

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

More information about the mono-bugs mailing list