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

java.lang.IllegalStateException: The service request was not made within 10 seconds of doBlockingWrite being invoked. Make sure to invoke the service request BEFORE invoking doBlockingWrite if your caller is single-threaded.ription) #754

Closed
ramakrishna-g1 opened this issue Jan 29, 2024 · 5 comments
Labels
bug This issue is a bug. p2 This is a standard priority issue

Comments

@ramakrishna-g1
Copy link

Describe the bug

The service request was not made within 10 seconds of doBlockingWrite being invoked. Make sure to invoke the service request BEFORE invoking doBlockingWrite if your caller is single-threaded.
at software.amazon.awssdk.core.async.BlockingInputStreamAsyncRequestBody.waitForSubscriptionIfNeeded(BlockingInputStreamAsyncRequestBody.java:110) ~[sdk-core-2.22.2.jar!/:na]
at software.amazon.awssdk.core.async.BlockingInputStreamAsyncRequestBody.writeInputStream(BlockingInputStreamAsyncRequestBody.java:74) ~[sdk-core-2.22.2.jar!/:na]

Expected Behavior

We are experiencing these failures very often even after using latest aws crt client "aws-crt-client" 2.23.12.
We expect this to wait for longer time / should have option to increase the time out which would be helpful when there is huge data with large files.

Current Behavior

We are trying to steam large number of files from source system to AWS s3 using Transfer manager by reading the stream using HttpURLConnection, below is sample code -

URL targetURL = new URL("URL");
HttpURLConnection urlConnection = (HttpURLConnection) targetURL.openConnection();
urlConnection.setRequestMethod(HttpMethod.GET.toString());
urlConnection.setRequestProperty(HttpHeaders.ACCEPT, MediaType.ALL_VALUE);

if (urlConnection.getResponseCode() == HttpStatus.OK.value()) {
BlockingInputStreamAsyncRequestBody body = AsyncRequestBody.forBlockingInputStream(null);

Upload upload = transferManager.upload(builder -> builder
		.requestBody(body)
		.addTransferListener(UploadProcessListener.create(fileTracker.getPath()))
		.putObjectRequest(req -> req.bucket(s3BucketName).key("v3/" + s3Key + "/" + fileTracker.getPath()))
		.build());

    long totalBytes = body.writeInputStream(urlConnection.getInputStream());

}

Reproduction Steps

URL targetURL = new URL("URL");
HttpURLConnection urlConnection = (HttpURLConnection) targetURL.openConnection();
urlConnection.setRequestMethod(HttpMethod.GET.toString());
urlConnection.setRequestProperty(HttpHeaders.ACCEPT, MediaType.ALL_VALUE);

if (urlConnection.getResponseCode() == HttpStatus.OK.value()) {
BlockingInputStreamAsyncRequestBody body = AsyncRequestBody.forBlockingInputStream(null);

Upload upload = transferManager.upload(builder -> builder
		.requestBody(body)
		.addTransferListener(UploadProcessListener.create(fileTracker.getPath()))
		.putObjectRequest(req -> req.bucket(s3BucketName).key("v3/" + s3Key + "/" + fileTracker.getPath()))
		.build());

    long totalBytes = body.writeInputStream(urlConnection.getInputStream());

}

Possible Solution

No response

Additional Information/Context

No response

aws-crt-java version used

2.23.12

Java version used

11

Operating System and version

window / linux

@ramakrishna-g1 ramakrishna-g1 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 29, 2024
@waahm7
Copy link
Contributor

waahm7 commented Feb 5, 2024

Hi, Thank you for creating the issue. Can you please create the issue at https://github.com/aws/aws-sdk-java-v2? This seems like an SDK Java issue instead of a crt-java specific issue. It would be easier to track and triage this issue in the SDK.

@ramakrishna-g1
Copy link
Author

Hi, Thank you for creating the issue. Can you please create the issue at https://github.com/aws/aws-sdk-java-v2? This seems like an SDK Java issue instead of a crt-java specific issue. It would be easier to track and triage this issue in the SDK.

Thanks for your response, I have created another ticket under aws-sdk-java-v2 - aws/aws-sdk-java-v2#4893

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to 'closing-soon' in 7 days. label Feb 6, 2024
@vswamy3
Copy link

vswamy3 commented Feb 6, 2024

I am also getting similar exceptions very often. even though the size of the file is very small. it is occurring only in the US region. The same code is running in other regions like EU and CN. but I have not encountered any issues.

@vswamy3
Copy link

vswamy3 commented Mar 4, 2024

any updates?

@TingDaoK
Copy link
Contributor

TingDaoK commented Apr 3, 2024

Close this prefer to aws/aws-sdk-java-v2#4893

@TingDaoK TingDaoK closed this as completed Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. p2 This is a standard priority issue
Projects
None yet
Development

No branches or pull requests

5 participants