-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Downloading large file getting this error [Caused by: okhttp3.internal.http2.StreamResetException: stream was reset: CANCEL] #2268
Comments
@ihudedi the SDK initialises the OkHttpClient with a default read timeout of To customize the timeouts & the HTTP client in general: OkHttpClient client = GraphClientFactory.create().readTimeout(Duration.ofSeconds(180)).build();
GraphServiceClient graphClient = new GraphServiceClient(
new AzureIdentityAuthenticationProvider(credential, new String[] {}, ".default"),
client
); let me know if this works/you have any further questions. |
Hi @Ndiritu |
Hi @Ndiritu |
@ihudedi my apologies, we should have tried to increase the OkHttpClient client = GraphClientFactory.create().callTimeout(Duration.ofSeconds(180)).build();
GraphServiceClient graphClient = new GraphServiceClient(
new AzureIdentityAuthenticationProvider(credential, new String[] {}, ".default"),
client
);
The SDK overrides these defaults to 100 seconds for the writeTimeout, readTimeout and callTimeout |
Hi @Ndiritu |
Hi @Ndiritu |
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
```The text was updated successfully, but these errors were encountered: