Skip to content

fix: transport use-after-close crashes append session - #93

Merged
quettabit merged 1 commit into
mainfrom
qb/92
Aug 12, 2026
Merged

fix: transport use-after-close crashes append session #93
quettabit merged 1 commit into
mainfrom
qb/92

Conversation

@quettabit

@quettabit quettabit commented Aug 11, 2026

Copy link
Copy Markdown
Member

resolves #92

an example for a use-after-close scenario that can cause this crash is calling transport's close twice.

@quettabit
quettabit force-pushed the qb/92 branch 4 times, most recently from 23c430c to 380cba1 Compare August 12, 2026 00:06
@quettabit quettabit changed the title [WIP] fix: transport use-after-close crashes append session Aug 12, 2026
@quettabit

Copy link
Copy Markdown
Member Author

@greptileai review pls

@greptile-apps

greptile-apps Bot commented Aug 12, 2026

Copy link
Copy Markdown

Greptile Summary

The PR prevents failed or closing transports from remaining eligible for pooled reuse and consolidates HTTP/2 writes behind one drain-aware flush path.

  • Adds send-side health and byte-count state to each connection.
  • Marks connections unavailable when socket writes or drains fail.
  • Uses forced drains for lifecycle-sensitive writes and threshold-based drains for data and acknowledgment traffic.
  • Updates the stream-ID allocation test for the consolidated flush method.

Confidence Score: 5/5

The PR appears safe to merge.

The changed flush path now catches socket write and drain failures, marks the connection send-dead, and excludes it from subsequent pool checkout, so no blocking failure remains.

Important Files Changed

Filename Overview
src/s2_sdk/_client.py Consolidates flushing and marks transports send-dead after socket failures, addressing the previously reported connection-reuse path.
tests/test_client.py Updates the existing stream-allocation test to mock the replacement flush method.

Reviews (3): Last reviewed commit: "initial commit" | Re-trigger Greptile

Comment thread src/s2_sdk/_client.py Outdated
@quettabit

Copy link
Copy Markdown
Member Author

@greptileai addressed your comments. pls review again.

@quettabit
quettabit marked this pull request as ready for review August 12, 2026 00:53
@quettabit
quettabit requested a review from a team as a code owner August 12, 2026 00:53
@quettabit
quettabit merged commit b075858 into main Aug 12, 2026
10 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.

HTTP/2 client: _flush_h2_data crashes with AttributeError on a torn-down SSL transport, permanently failing the append session

1 participant