<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:56:51 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>[JAVA-2294] GridFSDownloadStream - exception when destination buffer size != file chunk size</title>
                <link>https://jira.mongodb.org/browse/JAVA-2294</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;When using GridFSDownloadStream to download a file with multiple chunks, if you use a destination buffer whose size is not exactly equal to the file&apos;s chunk size then you will get the following exception:&lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;com.mongodb.MongoGridFSException: Could not find file chunk for files_id: BsonObjectId{value=57c87e6afc76010ce8f43887} at chunk index 2.&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&amp;nbsp;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;	at com.mongodb.async.client.gridfs.GridFSDownloadStreamImpl.chunkNotFound(GridFSDownloadStreamImpl.java:235)&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;	at com.mongodb.async.client.gridfs.GridFSDownloadStreamImpl.access$600(GridFSDownloadStreamImpl.java:38)&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;	at com.mongodb.async.client.gridfs.GridFSDownloadStreamImpl$5.onResult(GridFSDownloadStreamImpl.java:168)&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;	at com.mongodb.async.client.gridfs.GridFSDownloadStreamImpl$5.onResult(GridFSDownloadStreamImpl.java:162)&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;	at com.mongodb.operation.AsyncQueryBatchCursor.next(AsyncQueryBatchCursor.java:109)&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;	at com.mongodb.async.client.gridfs.GridFSDownloadStreamImpl.checkAndFetchResults(GridFSDownloadStreamImpl.java:162)&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;	at com.mongodb.async.client.gridfs.GridFSDownloadStreamImpl.read(GridFSDownloadStreamImpl.java:132)&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;I have created a GIST for a JUnit test which demonstrates the issue &amp;#8211; &lt;a href=&quot;https://gist.github.com/sfitts/6ac8fc6efa19ef86600ae5354682c5ca&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://gist.github.com/sfitts/6ac8fc6efa19ef86600ae5354682c5ca&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The issue seems to be that the code decides to do a read-ahead into a chunk that doesn&apos;t exist (it is one off the edge) and so doesn&apos;t get to use the data already sitting in &quot;buffer&quot; to fulfill the read.&lt;/p&gt;</description>
                <environment></environment>
        <key id="313548">JAVA-2294</key>
            <summary>GridFSDownloadStream - exception when destination buffer size != file chunk size</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="ross@mongodb.com">Ross Lawley</assignee>
                                    <reporter username="smfitts@gmail.com">Sean Fitts</reporter>
                        <labels>
                    </labels>
                <created>Thu, 1 Sep 2016 20:03:11 +0000</created>
                <updated>Wed, 19 Oct 2016 14:17:43 +0000</updated>
                            <resolved>Fri, 9 Sep 2016 15:21:10 +0000</resolved>
                                    <version>3.3.0</version>
                                    <fixVersion>3.4.0</fixVersion>
                                    <component>API</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="1380544" author="xgen-internal-githook" created="Fri, 9 Sep 2016 15:22:46 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;rozza&apos;, u&apos;name&apos;: u&apos;Ross Lawley&apos;, u&apos;email&apos;: u&apos;ross.lawley@gmail.com&apos;}
&lt;p&gt;Message: Fix Async GridFS Download to Stream small buffer bug&lt;/p&gt;

&lt;p&gt;When using a smaller than chunksize buffer, need to check the internal buffer has been read before trying to get the next chunk.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-2294&quot; title=&quot;GridFSDownloadStream - exception when destination buffer size != file chunk size&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-2294&quot;&gt;&lt;del&gt;JAVA-2294&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
Branch: 3.3.x&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/4cd3e84e4a547a8202313f04b46930218f5f15b8&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/4cd3e84e4a547a8202313f04b46930218f5f15b8&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1380542" author="xgen-internal-githook" created="Fri, 9 Sep 2016 15:20:13 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;rozza&apos;, u&apos;name&apos;: u&apos;Ross Lawley&apos;, u&apos;email&apos;: u&apos;ross.lawley@gmail.com&apos;}
&lt;p&gt;Message: Fix Async GridFS Download to Stream small buffer bug&lt;/p&gt;

&lt;p&gt;When using a smaller than chunksize buffer, need to check the internal buffer has been read before trying to get the next chunk.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-2294&quot; title=&quot;GridFSDownloadStream - exception when destination buffer size != file chunk size&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-2294&quot;&gt;&lt;del&gt;JAVA-2294&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/c39037ec809f8c4d7bdebbfa9a8a86d5bdd4e4e5&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/c39037ec809f8c4d7bdebbfa9a8a86d5bdd4e4e5&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1376772" author="smfitts@gmail.com" created="Mon, 5 Sep 2016 17:20:49 +0000"  >&lt;p&gt;No problem &amp;#8211; thanks for the quick fix.&lt;/p&gt;</comment>
                            <comment id="1376683" author="ross@10gen.com" created="Mon, 5 Sep 2016 13:25:30 +0000"  >&lt;p&gt;Thanks &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=smfitts%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;smfitts@gmail.com&quot;&gt;smfitts@gmail.com&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;For the ticket, the gist made it easy to reproduce the bug.  Unfortunately, it was missed in the test case for this exactly this issue - in the test case the chunk size wasn&apos;t a multiple of the chunk size, so eventually crossed chunk boundaries as expected.&lt;/p&gt;</comment>
                            <comment id="1376682" author="ross@10gen.com" created="Mon, 5 Sep 2016 13:22:07 +0000"  >&lt;p&gt;PR: &lt;a href=&quot;https://github.com/rozza/mongo-java-driver/pull/159&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/rozza/mongo-java-driver/pull/159&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1376297" author="smfitts@gmail.com" created="Sat, 3 Sep 2016 19:46:26 +0000"  >&lt;p&gt;Note that a value greater than chunk size works (as long as it is a multiple of chunk size), but lower values do not.  If you ever get to the point where there is data left to read out of the internal field &quot;buffer&quot;, but no more chunks remain then the exception above is thrown.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </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|hsp4g7:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="1200">JVM Sprint 35</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>