[Mono-bugs] [Bug 58588][Nor] New - MONO Beta 1 Bug: HTTP Unbuffered Stream Chunked-Encoding problem.

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 17 May 2004 02:35:18 -0400 (EDT)

Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by davidandrewtaylor@hotmail.com.


--- shadow/58588	2004-05-17 02:35:18.000000000 -0400
+++ shadow/58588.tmp.3335	2004-05-17 02:35:18.000000000 -0400
@@ -0,0 +1,88 @@
+Bug#: 58588
+Product: Mono: Class Libraries
+Version: unspecified
+OS: Red Hat 9.0
+OS Details: 
+Status: NEW   
+Severity: 004 Four hours
+Priority: Normal
+Component: System
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: davidandrewtaylor@hotmail.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+Summary: MONO Beta 1 Bug: HTTP Unbuffered Stream Chunked-Encoding problem.
+Description of Problem:
+I have found a nasty bug in MONO Beta 1 that has been pestering me for 
+some months and it is only now I have had enough time to get enough 
+details to provide a full report.  This bug ONLY occurs on MONO and never 
+occurs on MS.NET.
+The problem started when using the MONO WSDL.exe tool to generate a proxy 
+from a BEA WebLogic app server Web Service.  This was reported as bug: 
+58543.  However I can now report more specific details about this bug, as 
+it is definately a lower level HTTP bug.
+a) The bug specifically occurs when using an unbuffered XmlTextReader to 
+read a large file from a BEA WebLogic web server using Chunked-encoding 
+(the default).  About 90% of the time the request fails, whilst 10% of 
+the time it succeeds (an intermittent problem).
+b) If the XmlTextReader is replaced with a StreamReader the problem NEVER 
+c) If a BufferedStream wraps the Stream (and is read by the 
+XmlTextReader) the problem NEVER occurs.
+d) The problem occurs BOTH using WebClient and HttpWebRequest.
+e) If using HttpWebRequest and setting ProtocolVersion to 
+HttpVersion.Version10, (HTTP 1.0) the problem NEVER occurs.  I am 
+assuming this is because the server is using Chunked-Encoding and HTTP 
+1.0 does not support Chunked-Encoding.  So I think this fixed the problem 
+because chunked encoding is not being used.
+f) Front-ending the BEA Web Server with Apache also "Fixes" the problem.  
+In that when Apache is proxying into WebLogic on a different port the 
+problem NEVER occurs (there must be some slightly different network 
+behavior between Apache and MONO when using Chunked encoding).
+Note: When using a Network Monitor or a proxy it is easy to see that the 
+connection is closed before the entire request is returned from the 
+server.  Sometimes only 30-40% of the request is returned before MONO 
+closes the connection.  See the related bug report for a TCPDump.
+Note: This only happens for medium to documents (at least 100 lines or 
+more).  I am guessing it is something to do with the "Chatty" nature of 
+Chunked-Encoding and MONO not responding in time unless the stream is 
+wrapped with a buffered stream.
+Steps to reproduce the problem:
+XmlDocument doc = new System.Xml.XmlDocument();
+WebClient client = new WebClient();
+Stream stream = client.OpenRead("MyBeaServerUrl");
+XmlTextReader reader = new XmlTextReader(stream);
+Actual Results:
+Unhandled Exception: System.Xml.XmlException: Document element did not 
+in <0x00250> System.Xml.XmlTextReader:Read ()
+in <0x0007b> System.Xml.XmlDocument:ReadNode (System.Xml.XmlReader)
+in <0x0004f> System.Xml.XmlDocument:Load (System.Xml.XmlReader)
+in <0x001a4> Testing.Class1:Main (string[])
+Expected Results:
+This should NEVER fail and the document should be loaded into the 
+instance of the XmlDocument class.
+How often does this happen? 
+90% of the time when using the standard unbuffered XmlTextReader with 
+HTTP 1.1 (chunked-encoding).
+Additional Information:
+I have spent MANY days trying to get this level of detail to help you 
+guys resolve this bug.  However I realize it will be difficult that I 
+cannot directly expose the BEA instance to you (due to our production 
+security guys), and front-ending it with Apache just made fixed the 
+problem (aaaaargh).
+I am 99% convinced this is a nasty low-level bug in the MONO HTTP Stack.