aio-libs / aio-libs/aiohttp

Send explicit RuntimeError on response operations after session closing

Open
#2,202 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
16.5k
Forks
2.4k
Avg merge
17h 22m
Merged PRs (30d)
212

Description

Extracted from [aio-libs chat](https://gitter.im/aio-libs/Lobby)

> aiohttp.client_exceptions.ClientConnectionError: Connection closed when a response is significantly large: https://pastebin.com/NmmnqhVt though I am new to async stuff so likely doing something wrong...

> this is because you move response out of session context and session closes connection

> Yes, I see.
> First snippet uses aiohttp incorrectly, I don't think we need fix our code.
> Reading response after session closing is mistake.
> Well, we could raise another explicit exception like RuntimeError but I doubt if we need it.

> We have to raise exception, otherwise it is very hard to find source of the problem especially for developers new to aiohttp

See also #2193

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.