aws / aws/amazon-s3-encryption-client-java
S3EncryptionClient (not async) Unable to execute HTTP request: headersFuture is still not completed when onStream() is invoked.
- Ngôn ngữ chính
- Java
- Star
- 34
- Fork
- 21
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
The code where I create S3EncryptionClient and call it (3.1.1 library version)
```
private S3EncryptionClient getEncryptionClient(String regionName, KeyPair keyPair) {
return S3EncryptionClient.builder()
.rsaKeyPair(keyPair)
.enableDelayedAuthenticationMode(true)
.enableLegacyUnauthenticatedModes(true)
.enableLegacyWrappingAlgorithms(true)
.wrappedClient(getClient(regionName))
.wrappedAsyncClient(getAsyncClient(regionName))
.build();
}
...
private S3AsyncClient getAsyncClient(String regionName) {
return S3AsyncClient.builder()
.overrideConfiguration(createClientConfiguration())
.region(Region.of(regionName))
.build();
}
..
private ClientOverrideConfiguration createClientConfiguration() {
return S3Client.builder()
.httpClient(
ApacheHttpClient.builder()
.connectionTimeout(Duration.ofMillis(clientConnectionTimeout))
.build())
.overrideConfiguration()
.toBuilder()
.retryPolicy(RetryPolicy.builder().numRetries(NUM_RETRIES).build())
.apiCallAttemptTimeout(Duration.ofMillis(clientRequestTimeout))
.build();
}
...
...
return getInputStream(s3Client.getObject(getGetObjectRequest(storageKey)), isZip);
...
private InputStream getInputStream(ResponseInputStream is, boolean isZip)
throws IOException {
InputStream s3InputStream;
if (isZip) {
ZipInputStream zis = new ZipInputStream(is);
ZipEntry zipEntry = zis.getNextEntry(); // There should be only one entry in the ZIP file
log.debug("getReader: Found zip entry {}", zipEntry.getName());
s3InputStream = zis;
} else {
s3InputStream = is;
}
return s3InputStream;
}
```
The error I see:
```
Caused by: sotware.amazon.encryption.s3.S3EncryptionClientException: Unable to execute HTTP request: headersFuture is still not completed when onStream() is invoked.
at deployment.fs.war//software.amazon.encryption.s3.S3EncryptionClient.getObject(S3EncryptionClient.java:255)
Caused by: software.amazon.awssdk.core.exception.SdkClientException: Unable to execute HTTP request: headersFuture is still not completed when onStream() is invoked.
at deployment.fs.war//software.amazon.awssdk.core.exception.SdkClientException$BuilderImpl.build(SdkClientException.java:111)
at deployment.fs.war//software.amazon.awssdk.core.exception.SdkClientException.create(SdkClientException.java:47)
at deployment.fs.war//software.amazon.awssdk.core.internal.http.pipeline.stages.utils.RetryableStageHelper.setLastException(RetryableStageHelper.java:223)
at deployment.fs.war//software.amazon.awssdk.core.internal.http.pipeline.stages.utils.RetryableStageHelper.setLastException(RetryableStageHelper.java:218)
at deployment.fs.war//software.amazon.awssdk.core.internal.http.pipeline.stages.AsyncRetryableStage$RetryingExecutor.maybeRetryExecute(AsyncRetryableStage.java:182)
at deployment.fs.war//software.amazon.awssdk.core.internal.http.pipeline.stages.AsyncRetryableStage$RetryingExecutor.lambda$attemptExecute$1(AsyncRetryableStage.java:159)
at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:859)
at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:837)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
at java.base/java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:2088)
at deployment.fs.war//software.amazon.awssdk.utils.CompletableFutureUtils.lambda$forwardExceptionTo$0(CompletableFutureUtils.java:79)
at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:859)
at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:837)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
at java.base/java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:2088)
at deployment.fs.war//software.amazon.awssdk.core.internal.http.pipeline.stages.MakeAsyncHttpRequestStage.lambda$execute$0(MakeAsyncHttpRequestStage.java:108)
at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:859)
at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:837)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
at java.base/java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:2088)
at deployment.fs.war//software.amazon.awssdk.core.internal.http.pipeline.stages.MakeAsyncHttpRequestStage.completeResponseFuture(MakeAsyncHttpRequestStage.java:255)
at deployment.fs.war//software.amazon.awssdk.core.internal.http.pipeline.stages.MakeAsyncHttpRequestStage.lambda$executeHttpRequest$3(MakeAsyncHttpRequestStage.java:167)
at java.base/java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:930)
at java.base/java.util.concurrent.CompletableFuture$UniHandle.tryFire(CompletableFuture.java:907)
at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:478)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
```
The question is - why do I see something about the future if I do not use an async client?
How can I correctly get the response and use InputStream here? I can't see any wait/join function to wait
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu từ S3EncryptionClient.getObject, được xác định ở dòng 255 trong stack trace, và so sánh cấu hình của S3Client và S3AsyncClient được bọc như hiển thị trong báo cáo. Tái hiện request bằng thiết lập client được cung cấp và xác định lý do lệnh gọi đồng bộ gặp lỗi headersFuture; được xem là hoàn tất khi xác lập được cách sử dụng response/InputStream được hỗ trợ hoặc xác nhận được lỗi của client.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- aws, java
- Lĩnh vực
- api, backend
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 35/100