Skip to content

Add abortStream method to Http1StreamManager and ensure streams are released to connection pool - #1001

Open
alextwoods wants to merge 3 commits into
awslabs:mainfrom
alextwoods:alexwoo/abort_stream
Open

Add abortStream method to Http1StreamManager and ensure streams are released to connection pool#1001
alextwoods wants to merge 3 commits into
awslabs:mainfrom
alextwoods:alexwoo/abort_stream

Conversation

@alextwoods

Copy link
Copy Markdown
Contributor

Summary

  • Make Http1StreamManager robust against external stream cancellation (cancel() + close()) by guaranteeing the connection slot is always released back to the pool
  • Add abortStream() API to Http1StreamManager and HttpStreamManager as the correct way for callers to cancel in-flight streams without leaking pool capacity

Problem

When a caller (e.g., the SDK's timeout handler) calls stream.cancel() + stream.close(). (See Java SDK PR #6919 that introduces a new regression) on a stream obtained from Http1StreamManager, the connection slot is permanently leaked from the pool. This happens because Http1StreamManager only releases connections inside its onResponseComplete wrapper, and cancel() + close() can prevent that callback from being delivered — either because the native handle is released before the callback fires, or because the stream was closed before activation made it a no-op.

Under load with aggressive timeouts (e.g., after a network blip), this quickly exhausts the entire pool, causing 100% request failures with no recovery until process restart.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

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.

1 participant