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

fix streaming initial response for windows clients #3347

Merged
merged 3 commits into from
Mar 21, 2025
Merged

fix streaming initial response for windows clients #3347

merged 3 commits into from
Mar 21, 2025

Conversation

sbera87
Copy link
Contributor

@sbera87 sbera87 commented Mar 17, 2025

Issue #, if available:
Fix initial response handling for windows http client
Description of changes:

Check all that applies:

  • Did a review by yourself.
  • Added proper tests to cover this PR. (If tests are not applicable, explain.)
  • Checked if this PR is a breaking (APIs have been changed) change.
  • Checked if this PR will not introduce cross-platform inconsistent behavior.
  • Checked if this PR would require a ReadMe/Wiki update.

Check which platforms you have built SDK on to verify the correctness of this PR.

  • Linux
  • Windows
  • Android
  • MacOS
  • IOS
  • Other Platforms

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@sbera87 sbera87 changed the title fix initial response for windows clients fix streaming initial response for windows clients Mar 17, 2025
@sbera87 sbera87 requested a review from sbiscigl March 18, 2025 12:59
@sbera87 sbera87 marked this pull request as ready for review March 18, 2025 13:03
{
if (::testing::Test::HasFailure())
{
std::cout << "Test traces: " << testTrace << "\n";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont use std::cout use a AWS_LOG macro or google test assertion. additionally where is testTrace updated? can this be remove entirely? i sont see this string updated anywhere?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a pattern I used in the transcribe streaming tests where I wanted to keep test debug traces, but don't pollute output in case of success.

Likely to be a copy error from the test used as a template, and likely to be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall remove the debug messages

streamHandler->SetInitialResponseCallbackEx([&](const Aws::BedrockRuntime::Model::ConverseStreamInitialResponse& , const Aws::Utils::Event::InitialResponseType awsResponseType)
{
std::unique_lock<std::mutex> lock(mutex);
cv.wait(lock, [&] {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

never use wait in tests, always use wait_for or wait_until with reasonable timeouts. we have had too many instances of tests deadlocking on CI servers

additionally do want to wait here? seems like we actually arent waiting as this will never be woken up if the condition is not true the first time. seems like more so we just want to assert that awsResponseType is ON_RESPONSE and the mutex will handle the synchronized update of responseReceived with no wait needed

Copy link
Contributor Author

@sbera87 sbera87 Mar 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have simplified it in the next commit.

@@ -0,0 +1,36 @@
add_project(aws-cpp-sdk-bedrock-runtime-integration-tests
"Tests for Bedrock Runtime C++ SDK"
#aws-cpp-sdk-access-management
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove commented out dep on access-management

@sbera87 sbera87 force-pushed the winclient branch 2 times, most recently from c720ed7 to c11cac0 Compare March 20, 2025 14:40
m_client = Aws::MakeShared<BedrockRuntimeClient>(ALLOCATION_TAG, config);
}

void TearDown()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should remove TearDown if its a empty function

@sbera87 sbera87 merged commit 6c0163a into main Mar 21, 2025
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants