<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:35:43 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[CSHARP-71] Running a FindAll which returns more than 16KB of results causes an error.</title>
                <link>https://jira.mongodb.org/browse/CSHARP-71</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;This works fine with result sets up to around 16KB. I notice that BsonBuffer.chunkSize is set to 16KB, seems likely to be related? See the following stack trace issued when trying to create a new list from a FindAll query:&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;EndOfStreamException: Not enough input bytes available&amp;#93;&lt;/span&gt;&lt;br/&gt;
   MongoDB.BsonLibrary.IO.BsonBuffer.EnsureDataAvailable(Int32 needed) +159&lt;br/&gt;
   MongoDB.BsonLibrary.IO.BsonBuffer.ReadString() +217&lt;br/&gt;
   MongoDB.BsonLibrary.IO.BsonBinaryReader.ReadString(String&amp;amp; name) +299&lt;br/&gt;
   MongoDB.BsonLibrary.BsonElement.ReadFrom(BsonReader bsonReader, BsonElement&amp;amp; element) +422&lt;br/&gt;
   MongoDB.BsonLibrary.BsonDocument.Deserialize(BsonReader bsonReader) +111&lt;br/&gt;
   MongoDB.BsonLibrary.BsonDocument.ReadFrom(BsonReader bsonReader) +119&lt;br/&gt;
   MongoDB.BsonLibrary.BsonElement.ReadFrom(BsonReader bsonReader, BsonElement&amp;amp; element) +550&lt;br/&gt;
   MongoDB.BsonLibrary.BsonDocument.Deserialize(BsonReader bsonReader) +111&lt;br/&gt;
   MongoDB.BsonLibrary.BsonDocument.ReadFrom(BsonReader bsonReader) +119&lt;br/&gt;
   MongoDB.BsonLibrary.BsonElement.ReadFrom(BsonReader bsonReader, BsonElement&amp;amp; element) +550&lt;br/&gt;
   MongoDB.BsonLibrary.BsonDocument.Deserialize(BsonReader bsonReader) +111&lt;br/&gt;
   MongoDB.BsonLibrary.BsonDocument.ReadFrom(BsonReader bsonReader) +119&lt;br/&gt;
   MongoDB.BsonLibrary.Serialization.BsonSerializer.Deserialize(BsonReader bsonReader, Type type) +130&lt;br/&gt;
   MongoDB.BsonLibrary.Serialization.BsonSerializer.Deserialize(BsonReader bsonReader) +110&lt;br/&gt;
   MongoDB.CSharpDriver.Internal.MongoReplyMessage`1.ReadFrom(BsonBuffer buffer) +1119&lt;br/&gt;
   MongoDB.CSharpDriver.Internal.MongoConnection.ReceiveMessage() +470&lt;br/&gt;
   MongoDB.CSharpDriver.MongoCursorEnumerator.GetReply(MongoRequestMessage message) +262&lt;br/&gt;
   MongoDB.CSharpDriver.MongoCursorEnumerator.GetFirst() +937&lt;br/&gt;
   MongoDB.CSharpDriver.MongoCursorEnumerator.MoveNext() +260&lt;br/&gt;
   System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +472&lt;/p&gt;</description>
                <environment>IIS 7, .Net 4, Windows 7 64 bit.</environment>
        <key id="13394">CSHARP-71</key>
            <summary>Running a FindAll which returns more than 16KB of results causes an error.</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="9">Done</resolution>
                                        <assignee username="robert@mongodb.com">Robert Stam</assignee>
                                    <reporter username="barrydahlberg">Barry Dahlberg</reporter>
                        <labels>
                    </labels>
                <created>Sat, 16 Oct 2010 05:13:17 +0000</created>
                <updated>Tue, 16 Nov 2021 16:53:40 +0000</updated>
                            <resolved>Mon, 18 Oct 2010 20:55:25 +0000</resolved>
                                                                                        <votes>3</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="19317" author="christian@sparre.it" created="Mon, 18 Oct 2010 21:11:58 +0000"  >&lt;p&gt;Robert, the fix did it. Thank you&lt;/p&gt;

&lt;p&gt;Must get myself a git client, downloading those .zip files gets old very fast!!&lt;/p&gt;</comment>
                            <comment id="19316" author="rstam" created="Mon, 18 Oct 2010 21:06:48 +0000"  >&lt;p&gt;Barry, master should be in a usable state. It is passing all the unit tests. I try to keep master continuously in a usable state although obviously sometimes that won&apos;t be true!&lt;/p&gt;</comment>
                            <comment id="19315" author="rstam" created="Mon, 18 Oct 2010 21:04:08 +0000"  >&lt;p&gt;Christian, thanks for the file. I think I found the cause of the problem (see previous comment). An absurdly large value for size is a symptom that the reader lost its position in the buffers and read some random 4 bytes from the wrong place. A document can straddle a buffer chunk boundary either by being very big (as I used to reproduce the issue) or by being part of a large number of documents returned by FindAll (which is what you are seeing).&lt;/p&gt;

&lt;p&gt;Thanks so much for helping me reproduce this. Let me know if the fix committed does or does not resolve your exception. &lt;/p&gt;</comment>
                            <comment id="19314" author="barrydahlberg" created="Mon, 18 Oct 2010 21:03:16 +0000"  >&lt;p&gt;Thanks, glad you got that one, I had been unable to make it happen again, obviously my documents had a subtle change.&lt;/p&gt;

&lt;p&gt;Is master in a usable state?&lt;/p&gt;</comment>
                            <comment id="19312" author="rstam" created="Mon, 18 Oct 2010 20:55:25 +0000"  >&lt;p&gt;Fixed in master. Bug occurs when an element name in a large document straddles a chunk boundary in the BsonBuffer.&lt;/p&gt;</comment>
                            <comment id="19311" author="christian@sparre.it" created="Mon, 18 Oct 2010 20:47:29 +0000"  >&lt;p&gt;Hi Robert&lt;/p&gt;

&lt;p&gt;I&apos;ve attached a .bson file like you asked. The collection contains 63 of those and they are all around the same size +/- a few bytes.&lt;/p&gt;

&lt;p&gt;I&apos;m getting the following exception&lt;/p&gt;

&lt;p&gt;Message:&lt;br/&gt;
Not enough input bytes available: 1953723716 needed but only 979 available (at position 32779)&lt;/p&gt;

&lt;p&gt;Stacktrace:&lt;br/&gt;
   at MongoDB.BsonLibrary.IO.BsonBuffer.EnsureDataAvailable(Int32 needed) in D:\Projekter\mongodb-mongo-csharp-driver-5994ea3\BsonLibrary\IO\BsonBuffer.cs:line 590&lt;br/&gt;
   at MongoDB.BsonLibrary.IO.BsonBuffer.ReadString() in D:\Projekter\mongodb-mongo-csharp-driver-5994ea3\BsonLibrary\IO\BsonBuffer.cs:line 340&lt;br/&gt;
   at MongoDB.BsonLibrary.IO.BsonBinaryReader.ReadString(String&amp;amp; name) in D:\Projekter\mongodb-mongo-csharp-driver-5994ea3\BsonLibrary\IO\BsonBinaryReader.cs:line 481&lt;br/&gt;
   at MongoDB.BsonLibrary.BsonElement.ReadFrom(BsonReader bsonReader, BsonElement&amp;amp; element) in D:\Projekter\mongodb-mongo-csharp-driver-5994ea3\BsonLibrary\ObjectModel\BsonElement.cs:line 117&lt;br/&gt;
   at MongoDB.BsonLibrary.BsonDocument.DeserializeDocument(BsonReader bsonReader, Type nominalType) in D:\Projekter\mongodb-mongo-csharp-driver-5994ea3\BsonLibrary\ObjectModel\BsonDocument.cs:line 380&lt;br/&gt;
   at MongoDB.BsonLibrary.BsonDocument.ReadFrom(BsonReader bsonReader) in D:\Projekter\mongodb-mongo-csharp-driver-5994ea3\BsonLibrary\ObjectModel\BsonDocument.cs:line 214&lt;br/&gt;
   at MongoDB.BsonLibrary.BsonElement.ReadFrom(BsonReader bsonReader, BsonElement&amp;amp; element) in D:\Projekter\mongodb-mongo-csharp-driver-5994ea3\BsonLibrary\ObjectModel\BsonElement.cs:line 121&lt;br/&gt;
   at MongoDB.BsonLibrary.BsonArray.ReadFrom(BsonReader bsonReader) in D:\Projekter\mongodb-mongo-csharp-driver-5994ea3\BsonLibrary\ObjectModel\BsonArray.cs:line 218&lt;br/&gt;
   at MongoDB.BsonLibrary.BsonElement.ReadFrom(BsonReader bsonReader, BsonElement&amp;amp; element) in D:\Projekter\mongodb-mongo-csharp-driver-5994ea3\BsonLibrary\ObjectModel\BsonElement.cs:line 125&lt;br/&gt;
   at MongoDB.BsonLibrary.BsonDocument.DeserializeDocument(BsonReader bsonReader, Type nominalType) in D:\Projekter\mongodb-mongo-csharp-driver-5994ea3\BsonLibrary\ObjectModel\BsonDocument.cs:line 380&lt;br/&gt;
   at MongoDB.BsonLibrary.BsonDocument.ReadFrom(BsonReader bsonReader) in D:\Projekter\mongodb-mongo-csharp-driver-5994ea3\BsonLibrary\ObjectModel\BsonDocument.cs:line 214&lt;br/&gt;
   at MongoDB.BsonLibrary.Serialization.BsonSerializer.DeserializeDocument(BsonReader bsonReader, Type nominalType) in D:\Projekter\mongodb-mongo-csharp-driver-5994ea3\BsonLibrary\Serialization\BsonSerializer.cs:line 64&lt;br/&gt;
   at MongoDB.BsonLibrary.Serialization.BsonSerializer.DeserializeDocument&lt;span class=&quot;error&quot;&gt;&amp;#91;T&amp;#93;&lt;/span&gt;(BsonReader bsonReader) in D:\Projekter\mongodb-mongo-csharp-driver-5994ea3\BsonLibrary\Serialization\BsonSerializer.cs:line 44&lt;br/&gt;
   at MongoDB.CSharpDriver.Internal.MongoReplyMessage`1.ReadFrom(BsonBuffer buffer) in D:\Projekter\mongodb-mongo-csharp-driver-5994ea3\CSharpDriver\Internal\MongoReplyMessage.cs:line 88&lt;br/&gt;
   at MongoDB.CSharpDriver.Internal.MongoConnection.ReceiveMessage&lt;span class=&quot;error&quot;&gt;&amp;#91;TDocument&amp;#93;&lt;/span&gt;() in D:\Projekter\mongodb-mongo-csharp-driver-5994ea3\CSharpDriver\Internal\MongoConnection.cs:line 291&lt;br/&gt;
   at MongoDB.CSharpDriver.MongoCursor`2.MongoCursorEnumerator.GetReply(MongoRequestMessage message) in D:\Projekter\mongodb-mongo-csharp-driver-5994ea3\CSharpDriver\Core\MongoCursor.cs:line 477&lt;br/&gt;
   at MongoDB.CSharpDriver.MongoCursor`2.MongoCursorEnumerator.GetFirst() in D:\Projekter\mongodb-mongo-csharp-driver-5994ea3\CSharpDriver\Core\MongoCursor.cs:line 442&lt;br/&gt;
   at MongoDB.CSharpDriver.MongoCursor`2.MongoCursorEnumerator.MoveNext() in D:\Projekter\mongodb-mongo-csharp-driver-5994ea3\CSharpDriver\Core\MongoCursor.cs:line 369&lt;br/&gt;
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)&lt;br/&gt;
   at System.Linq.Enumerable.ToList&lt;span class=&quot;error&quot;&gt;&amp;#91;TSource&amp;#93;&lt;/span&gt;(IEnumerable`1 source)&lt;br/&gt;
   at ConsoleApplication2.Program.Main(String[] args) in c:\users\christian\documents\visual studio 2010\Projects\ConsoleApplication2\ConsoleApplication2\Program.cs:line 16&lt;br/&gt;
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)&lt;br/&gt;
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)&lt;br/&gt;
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()&lt;br/&gt;
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)&lt;br/&gt;
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)&lt;br/&gt;
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)&lt;br/&gt;
   at System.Threading.ThreadHelper.ThreadStart()&lt;/p&gt;


&lt;p&gt;I also tried to skip my way into the collection but ended up with the same result. This is some of the exception messages&lt;/p&gt;

&lt;p&gt;Skip(20) Limit(5)&lt;br/&gt;
Not enough input bytes available: 1836410965 needed but only 414 available (at position 16395)&lt;/p&gt;

&lt;p&gt;Skip(20) Limit(10)&lt;br/&gt;
Not enough input bytes available: 1836410965 needed but only 17225 available (at position 16395)&lt;/p&gt;

&lt;p&gt;When I&apos;m at the &quot;start&quot; of the collection I can get 9 documents, but when I&apos;m &quot;inside&quot; the collection I can only get fewer.&lt;/p&gt;

&lt;p&gt;Also if 1836410965 is bytes, that is quite a lot &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;

&lt;p&gt;I hope the above messages and info helps.&lt;/p&gt;</comment>
                            <comment id="19304" author="rstam" created="Mon, 18 Oct 2010 19:30:15 +0000"  >&lt;p&gt;I&apos;ve also enhanced the error message to indicate how many bytes were needed, how many were available, and to report the position in the buffer(s) at which the error occurred.&lt;/p&gt;</comment>
                            <comment id="19302" author="rstam" created="Mon, 18 Oct 2010 18:58:18 +0000"  >&lt;p&gt;I am unable to reproduce this using the &quot;json-with-docarray.txt&quot; file attached, but I think it&apos;s because some of the values are &lt;/p&gt;
{ &quot;Value&quot;, &quot;System.Byte[]&quot; }
&lt;p&gt; and the value is not really a string but a much larger binary value. I&apos;ll keep investigating to see if I can reproduce independently. If one of you could instrument your program to output the binary bson form that would help me a lot. Add:&lt;/p&gt;

&lt;p&gt;    document.WriteTo(&quot;csharp71.bson&quot;); // assuming document is of type BsonDocument&lt;/p&gt;

&lt;p&gt;to your program or set a breakpoint and execute the above statement in the immediate window and attach the &quot;csharp71.bson&quot; file to this bug report.&lt;/p&gt;

&lt;p&gt;Thanks!&lt;/p&gt;</comment>
                            <comment id="19270" author="barrydahlberg" created="Sun, 17 Oct 2010 07:55:32 +0000"  >&lt;p&gt;I have embedded documents but no arrays.&lt;/p&gt;</comment>
                            <comment id="19269" author="christian@sparre.it" created="Sun, 17 Oct 2010 06:38:44 +0000"  >&lt;p&gt;On further investigation I seem to only get this on documents that have embedded arrays of documents. I have attached &quot;json-with-docarray.txt&quot; with an example of one of the documents that causes the error.&lt;/p&gt;

&lt;p&gt;I have tested on documents with byte arrays in the 1-2 MB size, and there is no problems.&lt;/p&gt;</comment>
                            <comment id="19260" author="christian@sparre.it" created="Sat, 16 Oct 2010 19:32:36 +0000"  >&lt;p&gt;I&apos;m seeing this on the Find method as well&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="10518" name="csharp71.bson" size="3373" author="sparrez" created="Mon, 18 Oct 2010 20:47:28 +0000"/>
                            <attachment id="10515" name="json-with-docarray.txt" size="5168" author="sparrez" created="Sun, 17 Oct 2010 06:34:54 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrh9v3:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>14397</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>