Skip to content
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

Your socket connection to the server was not read from or written to within the timeout period. Idle connections will be closed #1542

Closed
nashid opened this issue Apr 5, 2018 · 8 comments
Labels
response-requested Waiting on additional info or feedback. Will move to "closing-soon" in 5 days.

Comments

@nashid
Copy link

nashid commented Apr 5, 2018

I am getting this error once I am making a putObject request.

It's not clear to me what is causing this issue. What is the root cause for this error and what would be the strategy to avoid this?

Secondly, how to make this a retryable so that aws-sdk retries while having this error. I am already setting the error retry which does not seem to have any effect.

com.amazonaws.services.s3.model.AmazonS3Exception: Your socket connection to the 
server was not read from or written to within the timeout period. Idle connections 
will be closed. (Service: Amazon S3; Status Code: 400; Error Code: RequestTimeout

Code:

  val s3ClientConfig = new ClientConfiguration().withMaxErrorRetry(3)
    .withConnectionTimeout(60 * 1000)
    .withSocketTimeout(60 * 1000)

In a similar issue (aws/aws-sdk-js#281), it was mentioned this happens when the provided Content-Length is larger than the number of bytes sent, causing S3 to wait for you to send a specified number of bytes then timeout while waiting.

However, for my case, I am not specifying any content length and I am simply invoking with:

PutObjectRequest(String bucketName, String key, File file)

@spfink
Copy link
Contributor

spfink commented Apr 5, 2018

Are you seeing this consistently or intermittently? Can you provide a code sample for where you are calling PutObjectRequest?

@nashid
Copy link
Author

nashid commented Apr 5, 2018

This is an intermittent error which we are observing recently and its making our aws batch jobs error-prone and not reliable.

 val s3ClientConfig = new ClientConfiguration().withMaxErrorRetry(3)
    .withConnectionTimeout(60 * 1000)
    .withSocketTimeout(60 * 1000)

 val amazonS3Client: AmazonS3 = AmazonS3ClientBuilder
    .standard()
    .withRegion("us-east-1")
    .withCredentials(new AWSStaticCredentialsProvider(credentials))
    .withClientConfiguration(s3ClientConfig).build

val objectRequest = new PutObjectRequest(s3config.s3Bucket, destination.path, file)

amazonS3Client.putObject(objectRequest)

@nashid
Copy link
Author

nashid commented Apr 9, 2018

@spfink do you need anything else from me on this?

@shorea
Copy link
Contributor

shorea commented Apr 11, 2018

Are these files being modified or appended to while you upload? What's the rate at which you upload files?

@nashid
Copy link
Author

nashid commented Apr 11, 2018

@shorea we prepare the files locally before uploading - so these files are not modified/appended while we are uploading.

The rate at which we upload is actually very low - at best ~10 upload per hour.

@shorea
Copy link
Contributor

shorea commented Apr 12, 2018

Given your other issue (#1544) I suggest you dive deep into the networking layer to see if there is something going on. If that all checks out I suggest reaching out to the S3 service team with some request ids (where possible).

@shorea
Copy link
Contributor

shorea commented Apr 16, 2018

Closing issue, feel free to reopen if you need further assistance from the SDK team.

@shorea shorea closed this as completed Apr 16, 2018
@debora-ito debora-ito added response-requested Waiting on additional info or feedback. Will move to "closing-soon" in 5 days. and removed needs-response labels Feb 25, 2020
@ngbalk
Copy link

ngbalk commented Apr 18, 2020

The OP's questions Secondly, how to make this a retryable so that aws-sdk retries while having this error. I am already setting the error retry which does not seem to have any effect. I think is still a good one that was not answered - how can we make this socket timeout 400 error code retry-able?
@shorea
cc: @debora-ito

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
response-requested Waiting on additional info or feedback. Will move to "closing-soon" in 5 days.
Projects
None yet
Development

No branches or pull requests

6 participants