Repository navigation
SdkClientException: Unable to execute HTTP request: Only one connection receive subscriber allowed #2444
Copy link
Copy link
Closed
Labels
closed-for-stalenessguidanceQuestion that needs advice or information.Question that needs advice or information.
Description
SdkClientException: Unable to execute HTTP request: Only one connection receive subscriber allowed
We are using java AWS SDK v2 for sending data to s3 using Java Http POST endpoint inside Reactive Spring Boot Webflux application.
Describe the issue
This error occurs 1-3 times in a week and only in production where the load is approx 10-30 RPS. It causes the dataloss as 1-3 HTTP json messages are not delivered. The SDK retry looks like applied for this case.
Steps to Reproduce
The reason of the issue is unknown
Unfortunately it happens only in production and not connected with the user data. Any recommendation how to simulate the issue in local environment will be really helpful.
Your Environment
- AWS Java SDK version used: 2.16.32
- JDK version used: OpenJDK 64-Bit Server VM AdoptOpenJDK (build 14.0.2+12, mixed mode, sharing)
- Operating System and version: Linux ingress-traffic-c5ddf5dd7-qm4vt 4.14.181-142.260.amzn2.x86_64 Add Travis config #1 SMP Wed Jun 24 19:07:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Full log log.txt
Snippet from the log:
426 ... 55 common frames omitted
427 Caused by: java.lang.IllegalStateException: Only one connection receive subscriber allowed.
428 ... 89 common frames omitted
429 at software.amazon.awssdk.core.internal.http.pipeline.stages.AsyncRetryableStage$RetryingExecutor.maybeRetryExecute(AsyncRetryableStage.java:143)
430 at software.amazon.awssdk.core.internal.http.pipeline.stages.utils.RetryableStageHelper.setLastException(RetryableStageHelper.java:194)
431 at software.amazon.awssdk.core.internal.http.pipeline.stages.utils.RetryableStageHelper.setLastException(RetryableStageHelper.java:198)
432 at software.amazon.awssdk.core.exception.SdkClientException.create(SdkClientException.java:43)
433 at software.amazon.awssdk.core.exception.SdkClientException$BuilderImpl.build(SdkClientException.java:98)
434 Caused by: software.amazon.awssdk.core.exception.SdkClientException: Unable to execute HTTP request: Only one connection receive subscriber allowed.
435 at java.base/java.lang.Thread.run(Thread.java:832)
436 at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
437 at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
438 at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
439 at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
440 at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
441 at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
Metrics details
10-04-2021 17:19:25.752 trace= span= �[35m[aws-java-sdk-NettyEventLoop-1-7]�[0;39m �[39mDEBUG�[0;39m c.n.e.o.t.c.a.LoggingMetricPublisher.? - aws sdk metrics: MetricCollection(name=ApiCall, metrics=[MetricRecord(metric=MarshallingDuration, value=PT0.000085333S), MetricRecord(metric=RetryCount, value=3), MetricRecord(metric=ApiCallSuccessful, value=false), MetricRecord(metric=OperationName, value=PutObject), MetricRecord(metric=ApiCallDuration, value=PT0.867155059S), MetricRecord(metric=CredentialsFetchDuration, value=PT0.000000895S), MetricRecord(metric=ServiceId, value=S3)], children=[MetricCollection(name=ApiCallAttempt, metrics=[MetricRecord(metric=SigningDuration, value=PT0.000059589S), MetricRecord(metric=ServiceCallDuration, value=PT0.481107161S), MetricRecord(metric=AwsExtendedRequestId, value=Qdpz3ZCYk6RFbSYc0SRQu8cjhikHwH78oekWHw65vc8aFR1moZvuwEYP3re31+YohV2H7PubDqc=), MetricRecord(metric=HttpStatusCode, value=500), MetricRecord(metric=BackoffDelayDuration, value=PT0S), MetricRecord(metric=AwsRequestId, value=D41X7XHXFWAMT2KX)], children=[MetricCollection(name=HttpClient, metrics=[MetricRecord(metric=AvailableConcurrency, value=2), MetricRecord(metric=MaxConcurrency, value=50), MetricRecord(metric=LeasedConcurrency, value=0), MetricRecord(metric=PendingConcurrencyAcquires, value=0), MetricRecord(metric=HttpClientName, value=NettyNio)], children=[])]), MetricCollection(name=ApiCallAttempt, metrics=[MetricRecord(metric=BackoffDelayDuration, value=PT0.083S), MetricRecord(metric=SigningDuration, value=PT0.000098252S)], children=[MetricCollection(name=HttpClient, metrics=[MetricRecord(metric=AvailableConcurrency, value=1), MetricRecord(metric=MaxConcurrency, value=50), MetricRecord(metric=LeasedConcurrency, value=0), MetricRecord(metric=PendingConcurrencyAcquires, value=0), MetricRecord(metric=HttpClientName, value=NettyNio)], children=[])]), MetricCollection(name=ApiCallAttempt, metrics=[MetricRecord(metric=BackoffDelayDuration, value=PT0.194S), MetricRecord(metric=SigningDuration, value=PT0.000170456S)], children=[MetricCollection(name=HttpClient, metrics=[MetricRecord(metric=AvailableConcurrency, value=1), MetricRecord(metric=MaxConcurrency, value=50), MetricRecord(metric=LeasedConcurrency, value=0), MetricRecord(metric=PendingConcurrencyAcquires, value=0), MetricRecord(metric=HttpClientName, value=NettyNio)], children=[])]), MetricCollection(name=ApiCallAttempt, metrics=[MetricRecord(metric=BackoffDelayDuration, value=PT0.051S), MetricRecord(metric=SigningDuration, value=PT0.000090042S)], children=[MetricCollection(name=HttpClient, metrics=[MetricRecord(metric=AvailableConcurrency, value=0), MetricRecord(metric=MaxConcurrency, value=50), MetricRecord(metric=LeasedConcurrency, value=0), MetricRecord(metric=PendingConcurrencyAcquires, value=0), MetricRecord(metric=HttpClientName, value=NettyNio)], children=[])])])
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
closed-for-stalenessguidanceQuestion that needs advice or information.Question that needs advice or information.
Activity
debora-ito commentedon Apr 30, 2021
@nikitsenka a quick search for
java.lang.IllegalStateException: Only one connection receive subscriber allowedand the results point to an issue with Spring Webflux:Looking at the logs the error is returned with a http status code 500, which the SDK will retry, as you mentioned. This doesn't look like an issue with the SDK itself, but if you'd like us to investigate further please provide a self-contained sample code we can use to reproduce.
nikitsenka commentedon Apr 30, 2021
@debora-ito thanks for the links. The only helpful is the first one but unfortunately it is a WebClient case and we are using AWS SDK NettyNio client. Please see the code snippet below. It is not compilable but just to show the usage of SDK.
Any recommendations will be helpful
nikitsenka commentedon Apr 30, 2021
We are using s3AsyncClientMap to store client object in memory and reuse them for subsequent requests from the same client. The idea is to not create client every time but reuse existing one to improve performance. Not sure is it really make sense. Maybe we can just create new client for each request. I did't found any example or recommendation regarding it on AWS SDK User guide. Will be great if you can suggest better approach or provide some example for it.
nikitsenka commentedon May 10, 2021
@debora-ito any ideas?
pkgonan commentedon Sep 24, 2021
I have same issue, any solution?
debora-ito commentedon May 20, 2022
@nikitsenka I'm sorry, getting back to this issue after a long time. Are you still seeing the error?
It is recommended to reuse the same client whenever possible, but if you need different client configurations than you need to create different clients. Creating a new client for every request is not recommended. I don't see any obvious problems with your implementation of
s3AsyncClientMap. We list some best practices in our Dev Guide and on Github.Marking this to auto-close soon, but let us know if you're still getting this error.
Merge pull request #2444 from aws/staging/045a76ff-d694-4e30-8e43-f0b…