AmazonWebServicesClientProxy.logRequestMetadataV2 causes a premature evaluation of the response object
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 42/100
Direção de pesquisa
Comece com injectCredentialsAndInvokeV2Async, injectCredentialsAndInvokeIterableV2, injectCredentialsAndInvokeV2InputStream e injectCredentialsAndInvokeV2Bytes e, em seguida, inspecione como cada um chama logRequestMetadataV2. Verifique se os resultados lazy de CompletableFuture, SdkIterable e ResponseInputStream não são consumidos durante o registro, enquanto as respostas resolvidas imediatamente continuam registrando metadados sem causar chamadas duplicadas à API do serviço.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Summary: AmazonWebServicesClientProxy.logRequestMetadataV2 causes lazily-evaluated SDK response objects (streams, iterables) to be evaluated immediately. A response resolve would immediately engage the SDK client and execute the service API calls. Whenever a consumer of this response object would access the data again, it would have to be re-resolved and the same API calls would be executed once again. The issue issue exists in the latest lib version.
Example: using injectCredentialsAndInvokeIterableV2 paginated operation causes the SDK to perform 2x more API requests.
Details:
AmazonWebServicesClientProxy exposes multiple handles to interact with the SDK client. A response object could be either immediately (plain AwsResponse object) or lazily (CompletableFuture<ResponseT>, SdkIterable<ResponseT>, ResponseInputStream<ResponseT>) evaluated. A private logging routine called logRequestMetadataV2 causes lazily evaluated response objects to be evaluated immediately for the sake of logging. The resolve would cause a full range of the service API calls to be executed. By default, the SDK would not perform a deep response cache, hence a secondary access to the response data would once again hook up the SDK client, which would perform the same set of API calls.
public <RequestT extends AwsRequest, ResultT extends AwsResponse, IterableT extends SdkIterable<ResultT>>
IterableT
injectCredentialsAndInvokeIterableV2(final RequestT request, final Function<RequestT, IterableT> requestFunction) {
AwsRequestOverrideConfiguration overrideConfiguration = AwsRequestOverrideConfiguration.builder()
.credentialsProvider(v2CredentialsProvider).build();
@SuppressWarnings("unchecked")
RequestT wrappedRequest = (RequestT) request.toBuilder().overrideConfiguration(overrideConfiguration).build();
try {
IterableT response = requestFunction.apply(wrappedRequest);
response.forEach(r -> logRequestMetadataV2(request, r)); // <- this invocation would resolve the response object immediately
return response; // <- the response object is returned to the invoker. It would be re-resolved upon a data access.
} catch (final Throwable e) {
loggerProxy.log(String.format("Failed to execute remote function: {%s}", e.getMessage()));
throw e;
}
}
Possible Mitigation: logRequestMetadataV2 (and any other kind of non-lazy logging) should be avoided on all non-immediately resolved result types in the following routines:
injectCredentialsAndInvokeV2AsyncinjectCredentialsAndInvokeIterableV2injectCredentialsAndInvokeV2InputStreaminjectCredentialsAndInvokeV2Bytes
- Linguagem predominante
- Java
- Estrelas
- 30
- Forks
- 48
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de aws-cloudformation/cloudformation-cli-java-plugin
-
Runtime compatibility issueAberta
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 25/100
aws-cloudformation/cloudformation-cli-java-plugin#415 · 1 comentário ·
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 25/100
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 20/100
-
injectCredentialsAndInvokeV2 method in proxy class doesn't support API's like PutObject from S3.Aberta
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 25/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 35/100
Todas as issues de aws-cloudformation/cloudformation-cli-java-plugin
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
aoqia194/leaf-loader#19 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
apache/streampark#4521 ·
-
Update license yearAberta0 - Backlog 1 - Ready documentation good first issue help wanted
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
-
cbor
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
FasterXML/jackson-dataformats-binary#844 ·
Mantenedores costumam responder em até 1 dia
-
Issue: Bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
OpenAPITools/openapi-generator#25107 ·
Mantenedores costumam responder em até 1 dia