Skip to content

Stream doesn't closes response object #604

@romasku

Description

@romasku

Long story short

When I use container.attach() it opens a connection as expected, but the underlying aiohttp response object is not closed. It leads to a warnings:

ResourceWarning: Unclosed response <ClientResponse(http://10.1.0.19:2375/v1.39/containers/912a83018d776abf6bc7e6ad0a7abca727a1dc8df40e286681abe779b8b3a473/attach?detachKeys=&logs=1&stdin=0&stdout=1&stderr=1&stream=1) [101 UPGRADED]>
  • Expected behaviour: no warning, response object closed
  • Actual behaviour: warning thrown about unclosed response object.

Additional details:

In the following code

async def close(self) -> None:
if self._resp is not None:
return
if self._closed:
return
assert self._resp is not None

Line if self._resp is not None: looks very suspicious, I think that the not there is a bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions