[Mono-bugs] [Bug 692461] New: HttpWebRequest is throwing ArgumentOutOfRange exception randomly
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Sun May 8 18:08:38 EDT 2011
https://bugzilla.novell.com/show_bug.cgi?id=692461
https://bugzilla.novell.com/show_bug.cgi?id=692461#c0
Summary: HttpWebRequest is throwing ArgumentOutOfRange
exception randomly
Classification: Mono
Product: Mono: Class Libraries
Version: 2.10.x
Platform: x86-64
OS/Version: Linux
Status: NEW
Severity: Normal
Priority: P5 - None
Component: System
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: novell at pasichnyk.net
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Blocker: ---
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.24
(KHTML, like Gecko) Chrome/11.0.696.60 Safari/534.24
Here is the error_log content:
Handling exception type ArgumentOutOfRangeException
Message is Non-negative number required.
Parameter name: srcOffset
IsTerminating is set to True
System.ArgumentOutOfRangeException: Non-negative number required.
Parameter name: srcOffset
at System.Buffer.BlockCopy (System.Array src, Int32 srcOffset, System.Array
dst, Int32 dstOffset, Int32 count) [0x00000] in <filename unknown>:0
at System.Net.WebConnectionStream.ReadAll () [0x00000] in <filename
unknown>:0
at System.Net.WebConnectionStream.CheckResponseInBuffer () [0x00000] in
<filename unknown>:0
at (wrapper remoting-invoke-with-check)
System.Net.WebConnectionStream:CheckResponseInBuffer ()
at System.Net.WebConnection.ReadDone (IAsyncResult result) [0x00000] in
<filename unknown>:0
[Sun May 08 14:38:30 2011] [error] (70014)End of file found: read_data failed
[Sun May 08 14:38:30 2011] [error] Command stream corrupted, last command was 1
[Sun May 08 14:38:30 2011] [error] (70014)End of file found: read_data failed
[Sun May 08 14:38:30 2011] [error] Command stream corrupted, last command was 1
[Sun May 08 14:38:30 2011] [error] (70014)End of file found: read_data failed
[Sun May 08 14:38:30 2011] [error] Command stream corrupted, last command was 1
[Sun May 08 14:38:30 2011] [error] (104)Connection reset by peer: read_data
failed
[Sun May 08 14:38:30 2011] [error] Command stream corrupted, last command was
-1
[Sun May 08 14:38:30 2011] [error] (70014)End of file found: read_data failed
[Sun May 08 14:38:30 2011] [error] Command stream corrupted, last command was 1
Example code that exhibits the issue from time to time (no clear repro):
{
HttpWebRequest request =
(HttpWebRequest)WebRequest.Create(Url);
request.Method = Method;
request.Timeout = 60000;
request.ReadWriteTimeout = 60000;
request.KeepAlive = false;
request.Proxy = null;
if (AllowGzip)
request.Headers.Add(HttpRequestHeader.AcceptEncoding, "gzip");
string responseJson = string.Empty;
HttpWebResponse response =
(HttpWebResponse)request.GetResponse();
if (response.StatusCode == HttpStatusCode.OK)
{
using (System.IO.Stream stream =
response.GetResponseStream())
{
responseJson = ReadAndUnzipStream(stream,
response.ContentEncoding);
}
return responseJson;
}
private static string ReadAndUnzipStream(System.IO.Stream stream, string
encoding)
{
if (encoding == "gzip")
{
using (ICSharpCode.SharpZipLib.GZip.GZipInputStream gzipStream
= new ICSharpCode.SharpZipLib.GZip.GZipInputStream(stream))
{
using (System.IO.StreamReader sr = new
System.IO.StreamReader(gzipStream))
{
return sr.ReadToEnd();
}
}
}
else
{
using (System.IO.StreamReader sr = new
System.IO.StreamReader(stream))
{
return sr.ReadToEnd();
}
}
}
Reproducible: Always
Steps to Reproduce:
1. Make calls to externally hosted JSON service
2. Occasionally observe exception being thrown
3.
Actual Results:
App crashes even if i catch(Exception) ???
Expected Results:
no exception is thrown
Is this occurring when the call times out?
Url called is like this:
http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/wa/wsLookup?id=418478743&country=US
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list