Fix EventStream initial message handling to prevent hangs #4440
+372
−153
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #4435
Previously, codegen would always call
try_recv_initial()for event streams, which would block waiting for an initial-request or initial-response message. This caused hangs when operations didn't have modeled initial messages.Changes:
Runtime (aws-smithy-http & aws-smithy-legacy-http):
recv()now filters out initial-request/initial-response messages and stores them in a separate buffertry_recv_initial()checks the buffer first before blockingtry_recv_initial_with_preprocessor()to legacy version for SigV4 supportCodegen:
try_recv_initial()whenhttpBindingResolver.handlesEventStreamInitialRequest()returns truetry_recv_initial_response()when there's a parser for non-event-stream output membersTests:
test_no_hang_without_initial_message()to verify operations without modeled initial messages don't hangtest_waits_for_initial_message_when_modeled()to verify operations with modeled initial messages still block correctlywait_for_response_ready()to ManualEventStreamClient for testing connection readinessDocumentation:
Motivation and Context
Description
Testing
Checklist
.changelogdirectory, specifying "client," "server," or both in theapplies_tokey..changelogdirectory, specifying "aws-sdk-rust" in theapplies_tokey.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.