aws / aws/aws-sdk-python

InvalidStateError on output stream close in BiDi API

Open Beginner friendly
#13 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
169
Forks
19
Avg merge
1d 20h
Merged PRs (30d)
11

Description

When using the BiDi API and closing the output stream, I always see low-level CRT futures that raise `concurrent.futures.InvalidStateError`

This seems to be occurring because `CRTResponseBody._on_complete()` is invoking `future.set_result(b"")` when the future is already in a `CANCELLED` state.

Although the error is mostly cosmetic, it still interrupts any higher-level async task loops.

Please add a guard or something like:
```
if not future.cancelled():
future.set_results(b"")
```

Contributor guide

Open the contributing guide

Research direction

Search for CRTResponseBody._on_complete and inspect how the output stream's future is completed during close. Reproduce the BiDi API output-stream close path, then verify that closing it no longer raises InvalidStateError when the future is cancelled.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.