AmazonWebServicesClientProxy.logRequestMetadataV2 causes a premature evaluation of the response object
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 42/100
Direzione di ricerca
Inizia con injectCredentialsAndInvokeV2Async, injectCredentialsAndInvokeIterableV2, injectCredentialsAndInvokeV2InputStream e injectCredentialsAndInvokeV2Bytes, quindi esamina come ciascuno chiama logRequestMetadataV2. Verifica che i risultati lazy di CompletableFuture, SdkIterable e ResponseInputStream non vengano consumati durante la registrazione, mentre le risposte risolte immediatamente continuino a registrare i metadati senza causare chiamate duplicate all’API del servizio.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Java
- Stelle
- 30
- Fork
- 48
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di aws-cloudformation/cloudformation-cli-java-plugin
-
Runtime compatibility issue Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
aws-cloudformation/cloudformation-cli-java-plugin#415 · 1 commento ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 20/100
-
injectCredentialsAndInvokeV2 method in proxy class doesn't support API's like PutObject from S3. Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
Tutte le issue di aws-cloudformation/cloudformation-cli-java-plugin
Issue simili
-
bug untriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
opensearch-project/ml-commons#5094 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
-
emitter:client:csharp feature
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
affects/8.10 affects/8.9 component/clients kind/bug likelihood/mid severity/mid
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Two open-case totals on one screen: the Programs tile says 15,858 and the nav badge says 15,868 Apertabug frontend maui-pilot
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100