Skip to content

Close responses when on cancellations occur during reading.#2156

Merged
lovelydinosaur merged 4 commits intomasterfrom
close-stream-on-base-exceptions
Mar 31, 2022
Merged

Close responses when on cancellations occur during reading.#2156
lovelydinosaur merged 4 commits intomasterfrom
close-stream-on-base-exceptions

Conversation

@lovelydinosaur
Copy link
Copy Markdown
Contributor

@lovelydinosaur lovelydinosaur commented Mar 31, 2022

Based on #2148 but adding a test case which doesn't introduce sleep into our test suite.

  • Add failing test case.
  • Fix test case by switching to except BaseException: ... close ... raise throughout.

Closes #2139

@lovelydinosaur lovelydinosaur merged commit 3350d7e into master Mar 31, 2022
@lovelydinosaur lovelydinosaur deleted the close-stream-on-base-exceptions branch March 31, 2022 12:41
@lovelydinosaur lovelydinosaur mentioned this pull request May 9, 2022
samclearman pushed a commit to titanmsp/httpx that referenced this pull request Apr 26, 2025
)

* Test case for clean stream closing on cancellations

* Test case for clean stream closing on cancellations

* Linting on tests

* responses should close on any BaseException
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.

Response not closed when timeout/cancel reading response stream, which cause RuntimeError: The connection pool was closed while 1 HTTP requests/responses were still in-flight.

2 participants