Skip to content

KeyError: <aiohttp.connector._TransportPlaceholder> #2193

Closed
@rndusr

Description

I'm not sure if this is a bug in aiohttp, but if it's a bug in my code, this error doesn't tell my anything:

  File "/home/ich/code/stig/stig/client/aiotransmission/rpc.py", line 328, in __post
    response = await self.__session.post(repr(self.__url), data=data, headers=self.__headers)
  File "/home/ich/code/aiohttp/aiohttp/helpers.py", line 102, in __await__
    ret = yield from self._coro
  File "/home/ich/code/aiohttp/aiohttp/client.py", line 233, in _request
    conn = yield from self._connector.connect(req)
  File "/home/ich/code/aiohttp/aiohttp/connector.py", line 386, in connect
    self._acquired.remove(placeholder)
KeyError: <aiohttp.connector._TransportPlaceholder object at 0x7f270bc78c88>

So, placeholder is added to self._acquired (line 379) and then removed again (line 386), but inbetween it has already been removed, hence the KeyError.

The culprit is self._create_connection(req) (line 382), and eventually self._loop.create_connection() (line 732), and then I'm losing track.

Anyway, a simple if placeholder in self._acquired: inserted in line 386 seems to fix the issue for me. Or it could be something wrong with my code, but then I still have no idea what it is I'm doing wrong. I'd appreciate any pointers what could cause this.

I can reproduce, but unfortunately not with simple, sharable code.

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions