Skip to content

Send explicit RuntimeError on response operations after session closing #2202

Open
@asvetlov

Description

@asvetlov

Extracted from aio-libs chat

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions