aws-sdk-java-v2 icon indicating copy to clipboard operation
aws-sdk-java-v2 copied to clipboard

S3 java.io.IOException: The connection was closed during the request

Open lxn179208 opened this issue 3 years ago • 3 comments

Describe the bug

Executing code and throw exception some times. `listReference.map { async { s3Accessor.readIonAsync(it) } }.awaitAll()

override suspend fun readIonAsync(s3Reference: S3Reference): IonValue { s3Client.getObject(GetObjectRequest.builder() .bucket(s3Reference.bucket) .key(s3Reference.key) .build(), AsyncResponseTransformer.toBytes()) .await() .asInputStream() .use { s3InputStream -> return ionLoader.load(s3InputStream)[0] }

}`

Exceptions: Suppressed: software.amazon.awssdk.core.exception.SdkClientException: Request attempt 1 failure: Unable to execute HTTP request: The connection was closed during the request. The request will usually succeed on a retry, but if it does not: consider disabling any proxies you have configured, enabling debug logging, or performing a TCP dump to identify the root cause. If this is a streaming operation, validate that data is being read or written in a timely manner. Channel Information: ChannelDiagnostics(channel=[id: 0x19da8a8e, L:/169.254.76.1:55244 ! R:xbt-recommendation-generation-workflow-context-gamma.s3.us-west-2.amazonaws.com/52.92.129.250:443], channelAge=PT8.789S, requestCount=2)

Suppressed: software.amazon.awssdk.core.exception.SdkClientException: Request attempt 2 failure: Unable to execute HTTP request: The connection was closed during the request. The request will usually succeed on a retry, but if it does not: consider disabling any proxies you have configured, enabling debug logging, or performing a TCP dump to identify the root cause. If this is a streaming operation, validate that data is being read or written in a timely manner. Channel Information: ChannelDiagnostics(channel=[id: 0x65025a6b, L:/169.254.76.1:55184 ! R:xbt-recommendation-generation-workflow-context-gamma.s3.us-west-2.amazonaws.com/52.92.129.250:443], channelAge=PT10.471S, requestCount=2)

Caused by: java.io.IOException: The connection was closed during the request. The request will usually succeed on a retry, but if it does not: consider disabling any proxies you have configured, enabling debug logging, or performing a TCP dump to identify the root cause. If this is a streaming operation, validate that data is being read or written in a timely manner. Channel Information: ChannelDiagnostics(channel=[id: 0x41e2c057, L:/169.254.76.1:55118 ! R:xbt-recommendation-generation-workflow-context-gamma.s3.us-west-2.amazonaws.com/52.92.129.250:443], channelAge=PT10.827S, requestCount=2)

at software.amazon.awssdk.http.nio.netty.internal.ResponseHandler.notifyIfResponseNotCompleted(ResponseHandler.java:472)

at software.amazon.awssdk.http.nio.netty.internal.ResponseHandler.channelInactive(ResponseHandler.java:222)

at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262)

at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248)

at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:241)

at io.netty.handler.logging.LoggingHandler.channelInactive(LoggingHandler.java:206)

at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262)

at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248)

at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:241)

at io.netty.channel.ChannelInboundHandlerAdapter.channelInactive(ChannelInboundHandlerAdapter.java:81)

at io.netty.handler.timeout.IdleStateHandler.channelInactive(IdleStateHandler.java:277)

at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262)

at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248)

at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:241)

at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelInactive(CombinedChannelDuplexHandler.java:418)

at io.netty.handler.codec.ByteToMessageDecoder.channelInputClosed(ByteToMessageDecoder.java:389)

at io.netty.handler.codec.ByteToMessageDecoder.channelInactive(ByteToMessageDecoder.java:354)

at io.netty.handler.codec.http.HttpClientCodec$Decoder.channelInactive(HttpClientCodec.java:326)

at io.netty.channel.CombinedChannelDuplexHandler.channelInactive(CombinedChannelDuplexHandler.java:221)

at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262)

at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248)

at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:241)

at io.netty.handler.codec.ByteToMessageDecoder.channelInputClosed(ByteToMessageDecoder.java:389)

at io.netty.handler.codec.ByteToMessageDecoder.channelInactive(ByteToMessageDecoder.java:354)

at io.netty.handler.ssl.SslHandler.channelInactive(SslHandler.java:1074)

at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262)

at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248)

at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:241)

at io.netty.channel.ChannelInboundHandlerAdapter.channelInactive(ChannelInboundHandlerAdapter.java:81)

at io.netty.handler.timeout.IdleStateHandler.channelInactive(IdleStateHandler.java:277)

at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262)

at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248)

at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:241)

at io.netty.channel.DefaultChannelPipeline$HeadContext.channelInactive(DefaultChannelPipeline.java:1405)

at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262)

at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248)

at io.netty.channel.DefaultChannelPipeline.fireChannelInactive(DefaultChannelPipeline.java:901)

at io.netty.channel.AbstractChannel$AbstractUnsafe$8.run(AbstractChannel.java:831)

at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)

at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:469)

at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:497)

at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)

at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)

... 1 more

Expected Behavior

works well

Current Behavior

Throw exceptions:

Reproduction Steps

not very easy, it happens some times.

Possible Solution

No response

Additional Information/Context

No response

AWS Java SDK version used

aws-sdk-java-v2

JDK version used

1.8

Operating System and version

linux

lxn179208 avatar May 05 '23 08:05 lxn179208

Hi @lxn179208 the logs show an IOException has occurred, and the request was retried. If it happens occasionally, it can be attributed to network connectivity issues. If you want to investigate it further, I recommend you enable the client-side metrics and generate tcp dumps at the time of the error, to obtain more insights on that particular connection.

debora-ito avatar May 15 '23 16:05 debora-ito

I don't understand.

"If it happens occasionally, it can be attributed to network connectivity issues" -- I mentioned in the text of the bug that I can reproduce it consistently.

"If you want to investigate it further, I recommend you enable the client-side metrics" -- I mentioned in the text of the bug that I have client side metrics enabled, and saw nothing interesting from them.

"generate tcp dumps at the time of the error" -- I mentioned in the text of the bug that I have a tcpdump, but it is large and contains information sensitive enough that I would want to convey it to you securely.

bryanl-dbl avatar Jul 11 '23 16:07 bryanl-dbl

Update: My "connection was closed" problem went away when I switched to the new CRT client for my asynchronous GetObject calls.

bryanl-dbl avatar Aug 02 '23 16:08 bryanl-dbl