-
Notifications
You must be signed in to change notification settings - Fork 905
NPE in TransformingAsyncResponseHandler#onError #1812
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
Comments
Thank you for reporting the issue! We will look into it. |
I am also seeing this error when attempting to call
|
Any news regarding this issue?
Downgrading to version 2.5.8 works fine. |
…ler#onError, ignoring" could be logged during an unrelated failure. Fixes #1812
Same issue here |
I bit this pretty hard and consistently. Root cause ended up being because I didn't setup an Xray segment for the thread the call was being made in so the call was failing with the xray interceptor in the sqs client, but I was only able to find that out by repackaging the aws sdk code with a println in AsyncResponseHandler.onError. I would say that this is pretty unusable in it's current form :'( |
This reproduced the issue consistently for me: S3AsyncClient s3AsyncClient = S3AsyncClient.create();
Thread thread = new Thread(() -> s3AsyncClient.copyObject(CopyObjectRequest.builder().build()));
thread.interrupt();
thread.start();
thread.join(); I would expect this to throw an AbortedException/CancellationException/InterruptedException however due to the bug it's a NullPointerException. |
We are also seeing this error frequently using the Kinesis library during a |
also experiencing this with latest |
Exclude connectchat from japicmp check
For anyone else who landed here that is also using Reactor (and was confused by the logs they were seeing) or who might be incorrectly using the SDK; I had code similar to this: byte[] data = ...
String key = ...
CompletableFuture<PutObjectResponse> future = client.putObject(
PutObjectRequest.builder().bucket(bucket).key(key).build(),
AsyncRequestBody.fromBytes(data)
);
return Mono.fromFuture(future)
.retryWhen(...)
.doOnSuccess(res -> {...})
.onErrorResume((throwable) -> {...}); The issue is that PutObjectRequest request = PutObjectRequest.builder().bucket(bucket).key(key).build();
AsyncRequestBody requestBody = AsyncRequestBody.fromBytes(data);
return Mono.defer(() -> {
// Defer the creation of the future until subscription.
// This allows retries to create a new future on each attempt.
CompletableFuture<PutObjectResponse> future = client.putObject(request, requestBody);
return Mono.fromFuture(future);
})
.retryWhen(...)
.doOnSuccess(res -> {...})
.onErrorResume((throwable) -> {...}); The above code uses Now of course this does not fix the underlying issue with the SDK which is logging a misleading/unnecessary error - just thought this would be helpful for others who might also have been using the SDK wrong. I think I have a patch for that though! |
Hey AWS. This issue is open for about 3 years and we are still affected by this in one of our production systems. Can you please give us a timeline for when this will be fixed? Thank you so much! |
Hello @jenshoffmann1331 , Thank you very much for reaching out. We unfortunately do not have any current publicly available timeline. I will bring this issue back up for discussion. Best, Yasmine |
Strange that this is still not fixed.
That Unfortunately we cannot override
I really would like to know the reason behind my failure instead of just plain NPE... Thanks for understanding! |
Looks like this has been fixed now? https://github.com/aws/aws-sdk-java-v2/pull/4567/files#diff-18f6745a85126bf1b23736af8857375b8e7328956262a3d7f08e5bb5b7684303 |
Yes this should be fixed now, thank you @seantsb for pointing out. If anyone is still experiencing these NPEs, please upgrade your SDK version (version 2.21.1 includes the fix, but latest is best) and open a new issue. |
This issue is now closed. Comments on closed issues are hard for our team to see. |
Describe the bug
From time to time, we get an ERROR log from
TransformingAsyncResponseHandler
telling us that there was an NPE. It does not affect our app in any way, however it feels that it shouldn't throw that.Expected Behavior
No log record nor NPE.
Current Behavior
We get this log statement after NPE has been raised in aws sdk core
Steps to Reproduce
I don't know a deterministic way.
Possible Solution
I realize that the NPE comes from
AsyncResponseHandler
:where streamFuture is null, as
prepare()
has not been called yet.Context
The context is we're doing an async requests to ddb, and for some requests we may cancel them via
future.cancel()
. Apart from that we're not doing anything special with our query requests.Your Environment
AWS-SDK: 2.13.8
Java: 12
The text was updated successfully, but these errors were encountered: