Skip to content

Cannot configure read timeout for bidirectional streaming - HTTP client customization causes HTTP 464 errors #6629

@natedenh

Description

@natedenh

Describe the bug

When using invokeModelWithBidirectionalStream for Amazon Bedrock Nova Sonic, the default Netty HTTP client has a ~30 second read timeout that cannot be extended. Any attempt to customize the HTTP client results in HTTP 464 errors from the server.

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

Ability to configure read timeout for long-running bidirectional streaming sessions (e.g., 2-5 minutes) for voice applications where natural conversation pauses can exceed 30 seconds.

Current Behavior

After ~30 seconds of no data from the server, the connection fails with:
io.netty.handler.timeout.ReadTimeoutException: null

Reproduction Steps

  1. Create a bidirectional streaming session with Bedrock Nova Sonic
  2. Let the session sit idle (no speech detected) for >30 seconds
  3. Connection terminates with ReadTimeoutException

Attempted Solutions (all cause HTTP 464)

// Attempt 1: Custom read timeout
NettyNioAsyncHttpClient.builder()
.readTimeout(Duration.ofMinutes(5))
.build()
// Result: HTTP 464 error

// Attempt 2: HTTP/2 PING keep-alive
NettyNioAsyncHttpClient.builder()
.http2Configuration(Http2Configuration.builder()
.healthCheckPingPeriod(Duration.ofSeconds(15))
.build())
.build()
// Result: HTTP 464 error

// Attempt 3: AWS CRT client
AwsCrtAsyncHttpClient.builder()
.readTimeout(Duration.ofMinutes(5))
.build()
// Result: HTTP 464 error

Does not affect HTTP layer:
// SDK-level timeouts don't help
ClientOverrideConfiguration.builder()
.apiCallTimeout(Duration.ofMinutes(15))
.apiCallAttemptTimeout(Duration.ofMinutes(15))
.build()
// Result: Still get ReadTimeoutException at ~30s

Only working configuration (with hardcoded timeout):
BedrockRuntimeAsyncClient.builder()
.region(Region.US_EAST_1)
.build() // No HTTP client customization

Possible Solution

Suggestions:

  1. Allow read timeout configuration without triggering HTTP 464
  2. Document the limitation and recommended workarounds
  3. Provide an alternative mechanism to extend streaming session timeouts

Additional Information/Context

  • Voice applications need longer timeouts for natural conversation pauses
    • Zoom meetings with multiple participants can have extended silence periods
    • The 464 error suggests server-side validation rejecting custom HTTP clients

AWS Java SDK version used

2.40.5

JDK version used

openjdk version "21.0.3" 2024-04-16 LTS OpenJDK Runtime Environment Corretto-21.0.3.9.1 (build 21.0.3+9-LTS) OpenJDK 64-Bit Server VM Corretto-21.0.3.9.1 (build 21.0.3+9-LTS, mixed mode, sharing)

Operating System and version

MacOS Tahoe 26.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.needs-triageThis issue or PR still needs to be triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions