<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 09:00:07 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-3650] GridFSDownloadPublisher can&apos;t handle &gt; 2 GB</title>
                <link>https://jira.mongodb.org/browse/JAVA-3650</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;After upgrading to Java driver 3.12 and using&#160;the Reactive Streams-based asynchronous driver, it is not possible anymore to download files bigger than 2 GB. In the older version using GridFSDownloadStream it was supported, however GridFSDownloadPublisherImpl is limited by int. The code breaks here on allocate when exceeding max value 2147483647, then the remaining intValue() becomes negative:&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;                    &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;int&lt;/span&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; byteBufferSize = Math.max(chunkSize, bufferSizeBytes);&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;                    byteBufferSize =  Math.min(Long.valueOf(remaining).intValue(), byteBufferSize);&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;                    ByteBuffer byteBuffer = ByteBuffer.allocate(byteBufferSize);&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;Is it possible to use long instead of int for the byte buffer to avoid this?&lt;/p&gt;

&lt;p&gt;See also related Jira where it was fixed to handle larger files in the old implementation of GridFSDownloadStreamImpl:&#160;&lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-2548&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/JAVA-2548&lt;/a&gt;&lt;/p&gt;</description>
                <environment></environment>
        <key id="1253210">JAVA-3650</key>
            <summary>GridFSDownloadPublisher can&apos;t handle &gt; 2 GB</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="13201">Fixed</resolution>
                                        <assignee username="ross@mongodb.com">Ross Lawley</assignee>
                                    <reporter username="tamara.ockhuijsen@klm.com">Tamara Ockhuijsen</reporter>
                        <labels>
                    </labels>
                <created>Mon, 9 Mar 2020 15:49:30 +0000</created>
                <updated>Sat, 28 Oct 2023 11:21:46 +0000</updated>
                            <resolved>Tue, 10 Mar 2020 16:01:54 +0000</resolved>
                                    <version>3.12.1</version>
                                    <fixVersion>4.0.1</fixVersion>
                                    <component>Reactive Streams</component>
                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="2965135" author="tamara.ockhuijsen@klm.com" created="Wed, 11 Mar 2020 12:54:11 +0000"  >&lt;p&gt;You are right, thanks Ross! It was indeed not the publisher that blocked the download. I managed to download 4 GB files with this fix&#160;&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;</comment>
                            <comment id="2960945" author="xgen-internal-githook" created="Tue, 10 Mar 2020 16:25:32 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Ross Lawley&apos;, &apos;username&apos;: &apos;rozza&apos;, &apos;email&apos;: &apos;ross.lawley@gmail.com&apos;}
&lt;p&gt;Message: Added Integer size check to the download publisher&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-3650&quot; title=&quot;GridFSDownloadPublisher can&amp;#39;t handle &amp;gt; 2 GB&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-3650&quot;&gt;&lt;del&gt;JAVA-3650&lt;/del&gt;&lt;/a&gt; JAVARS-227&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver-reactivestreams/commit/d3dc13bbab582734b7387d109c65d6d75c08f944&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver-reactivestreams/commit/d3dc13bbab582734b7387d109c65d6d75c08f944&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2960682" author="xgen-internal-githook" created="Tue, 10 Mar 2020 15:55:54 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;username&apos;: &apos;rozza&apos;, &apos;name&apos;: &apos;Ross Lawley&apos;, &apos;email&apos;: &apos;ross.lawley@gmail.com&apos;}
&lt;p&gt;Message: Added Integer size check to the download publisher&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-3650&quot; title=&quot;GridFSDownloadPublisher can&amp;#39;t handle &amp;gt; 2 GB&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-3650&quot;&gt;&lt;del&gt;JAVA-3650&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-reactivestreams/commit/7ba3dd32212dfc8dbfcaa5e26a777e0ef5957709&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver-reactivestreams/commit/7ba3dd32212dfc8dbfcaa5e26a777e0ef5957709&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2960664" author="xgen-internal-githook" created="Tue, 10 Mar 2020 15:53:43 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Ross Lawley&apos;, &apos;username&apos;: &apos;rozza&apos;, &apos;email&apos;: &apos;ross.lawley@gmail.com&apos;}
&lt;p&gt;Message: Added Integer size check to the download publisher&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-3650&quot; title=&quot;GridFSDownloadPublisher can&amp;#39;t handle &amp;gt; 2 GB&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-3650&quot;&gt;&lt;del&gt;JAVA-3650&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/488cf07606301cbab784c8077404b6dfdd10841b&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/488cf07606301cbab784c8077404b6dfdd10841b&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2960652" author="xgen-internal-githook" created="Tue, 10 Mar 2020 15:52:01 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Ross Lawley&apos;, &apos;username&apos;: &apos;rozza&apos;, &apos;email&apos;: &apos;ross.lawley@gmail.com&apos;}
&lt;p&gt;Message: Added Integer size check to the download publisher&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-3650&quot; title=&quot;GridFSDownloadPublisher can&amp;#39;t handle &amp;gt; 2 GB&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-3650&quot;&gt;&lt;del&gt;JAVA-3650&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
Branch: 4.0.x&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/5640ad5aad67d32cf352e051c1346a6b3aac726b&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/5640ad5aad67d32cf352e051c1346a6b3aac726b&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2960148" author="ross@10gen.com" created="Tue, 10 Mar 2020 13:16:10 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=tamara.ockhuijsen%40klm.com&quot; class=&quot;user-hover&quot; rel=&quot;tamara.ockhuijsen@klm.com&quot;&gt;tamara.ockhuijsen@klm.com&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;I believe this should fix the issue,&#160; the&#160; &lt;tt&gt;byteBufferSize&lt;/tt&gt; is used for the publisher which can produce multiple bytebuffers which together represent the file.&#160; For large files you can either stream these chunks into the output destination or you can recreate the whole file by concatenating these streamed chunks.&lt;/p&gt;

&lt;p&gt;I hope that will meet your needs,&lt;/p&gt;

&lt;p&gt;Ross&lt;/p&gt;



&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="2960131" author="tamara.ockhuijsen@klm.com" created="Tue, 10 Mar 2020 13:02:12 +0000"  >&lt;p&gt;Thanks Ross for picking up this task so quickly. Next to checking the max size, do you also plan to support files which exceed the 2 GB that can be hold in an integer?&lt;/p&gt;</comment>
                            <comment id="2960057" author="ross@10gen.com" created="Tue, 10 Mar 2020 12:14:07 +0000"  >&lt;p&gt;PR:&#160;&lt;a href=&quot;https://github.com/rozza/mongo-java-driver/pull/374&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/rozza/mongo-java-driver/pull/374&lt;/a&gt;&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|hwsvmn:</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>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>