-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 3.12.1
-
Component/s: Reactive Streams
-
None
After upgrading to Java driver 3.12 and using 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:
int byteBufferSize = Math.max(chunkSize, bufferSizeBytes); byteBufferSize = Math.min(Long.valueOf(remaining).intValue(), byteBufferSize); ByteBuffer byteBuffer = ByteBuffer.allocate(byteBufferSize);
Is it possible to use long instead of int for the byte buffer to avoid this?
See also related Jira where it was fixed to handle larger files in the old implementation of GridFSDownloadStreamImpl: https://jira.mongodb.org/browse/JAVA-2548