[Mono-bugs] [Bug 591291] New: XmlInputStream.Read may block with unprocessed bytes in buffer

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Mar 25 19:10:15 EDT 2010


http://bugzilla.novell.com/show_bug.cgi?id=591291

http://bugzilla.novell.com/show_bug.cgi?id=591291#c0


           Summary: XmlInputStream.Read may block with unprocessed bytes
                    in buffer
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.6.x
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.XML
        AssignedTo: atsushi at ximian.com
        ReportedBy: mapperso at cisco.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8)
Gecko/20100204 SUSE/3.5.8-0.1.1 Firefox/3.5.8

I'm using an XmlReader with the source stream being the output stream of a
WebResponse.  When the internal XmlInputStream is initialized with the source
stream, it reads available data up to the size of it's internal buffer.  In my
case, a very small amount of data is initially available.  When the XmlReader
begins parsing it first calls XmlInputStream which does a blocking read on the
source stream because the amount of data in it's internal buffer was smaller
than requested.

This is inconsistent with Microsoft's XmlReader buffering which parses all
available stream data before blocking.

I was able to resolve my issue and get correct behavior with the following
change...

diff XmlInputStream.cs
/usr/src/packages/BUILD/mono-2.6.3/mcs/class/System.XML/System.Xml/XmlInputStream.cs
576c576,577
<                               ret = (0 == bufRest) ? stream.Read (buffer,
offset + bufRest, count - bufRest) : bufRest;
---
>                               ret = bufRest +
>                                       stream.Read (buffer, offset + bufRest, count - bufRest);

Reproducible: Always

Steps to Reproduce:
1.Create a Stream and push a small amount of data into it (<1024 bytes)
2.Create an XmlReader over the Stream
3.Read from the XmlReader

-- 
Configure bugmail: http://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