Skip to content

Downloading large file getting this error [Caused by: okhttp3.internal.http2.StreamResetException: stream was reset: CANCEL] #2268

@ihudedi

Description

@ihudedi

Describe the bug

Hi,
When downlaoding large file via (buffer can be 512KB,4MB,8MB and it's always fail)

try(InputStream inputStream = graphServiceClient.drives().byDriveId(driveId).items().byDriveItemId(getDriveItemIdFromRootPath(filePath)).content().get()){
byte[] buf = new byte[spoFileCopy.getCloudPartSizeWhenDownloadingToLocal()];
int bytesRead;
while ((bytesRead = srcInputStream.read(buf)) != -1) {
spoFileCopy.getOutputStream().write(buf, 0, bytesRead);
}
} catch (Exception e) {
logger.error(String.format("Error in SPOWrapper::downloadFileToLocalFileSystem: filePath= '%s' %s", originalFilePath, e.getMessage()), e);
throw e;
} finally {
logger.debug(String.format("End SPOWrapper::downloadFileToLocalFileSystem: filePath= '%s' ", originalFilePath));
}

I am getting this error after ~90 seconds of downlaoding:
java.io.InterruptedIOException: timeout
at okhttp3.internal.connection.RealCall.timeoutExit(RealCall.kt:398) ~[okhttp-4.12.0.jar!/:?]
at okhttp3.internal.connection.RealCall.callDone(RealCall.kt:360) ~[okhttp-4.12.0.jar!/:?]
at okhttp3.internal.connection.RealCall.messageDone$okhttp(RealCall.kt:309) ~[okhttp-4.12.0.jar!/:?]
at okhttp3.internal.connection.Exchange.bodyComplete(Exchange.kt:198) ~[okhttp-4.12.0.jar!/:?]
at okhttp3.internal.connection.Exchange$ResponseBodySource.complete(Exchange.kt:329) ~[okhttp-4.12.0.jar!/:?]
at okhttp3.internal.connection.Exchange$ResponseBodySource.read(Exchange.kt:305) ~[okhttp-4.12.0.jar!/:?]
at okio.RealBufferedSource$inputStream$1.read(RealBufferedSource.kt:162) ~[okio-jvm-3.9.1.jar!/:?]
at java.base/java.io.InputStream.read(Unknown Source) ~[?:?]
at com.bmc.cm.aft.client.wrapper.SPOWrapper.downloadFileToLocalFileSystem(SPOWrapper.java:919) [classes!/:?]
at com.bmc.cm.aft.client.SPODownloadToLocalFileCopy.downloadFileToLocalFileSystem(SPODownloadToLocalFileCopy.java:77) [classes!/:?]
at com.bmc.cm.aft.client.CloudFileCopy.copyFile(CloudFileCopy.java:172) [classes!/:?]
at com.bmc.cm.aft.client.FileCopy.transfer(FileCopy.java:1682) [classes!/:?]
at com.bmc.cm.aft.client.FileCopy.run(FileCopy.java:1513) [classes!/:?]
at com.bmc.cm.aft.client.FTCTransfer.copySingleFile(FTCTransfer.java:925) [classes!/:?]
at com.bmc.cm.aft.client.FTCTransfer.copy(FTCTransfer.java:802) [classes!/:?]
at com.bmc.cm.aft.client.FTCTransfer.runCopy(FTCTransfer.java:383) [classes!/:?]
at com.bmc.cm.aft.client.FTCTransfer.run(FTCTransfer.java:312) [classes!/:?]
at com.bmc.cm.aft.client.SubtaskRunner.run(SubtaskRunner.java:628) [classes!/:?]
at com.bmc.cm.aft.client.FTCHandler.runSubTasks(FTCHandler.java:388) [classes!/:?]
at com.bmc.cm.aft.client.FTCHandler.runJob(FTCHandler.java:219) [classes!/:?]
at com.bmc.cm.aft.jobmanagement.JobObjectImpl$JobRunnerThread.run(JobObjectImpl.java:401) [classes!/:?]
Caused by: okhttp3.internal.http2.StreamResetException: stream was reset: CANCEL
at okhttp3.internal.http2.Http2Stream$FramingSource.read(Http2Stream.kt:355) ~[okhttp-4.12.0.jar!/:?]
at okhttp3.internal.connection.Exchange$ResponseBodySource.read(Exchange.kt:281) ~[okhttp-4.12.0.jar!/:?]
... 15 more

I don't have timeout - I see all to some minutes.
When the file is large and it takes time to download this error is arised.
Not always but reproduce with 1GB
Thanks,
Itay

Expected behavior

File should download completed.

How to reproduce

See all code above

SDK Version

6.25.1

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output

Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions