Skip to content

infinite hang on release #431

@thehesiod

Description

@thehesiod
  • asyncpg version: 0.18.3
  • PostgreSQL version: 9.6
  • Python version: 3.6
  • Platform: linux
  • Do you use pgbouncer?: No
  • Did you install asyncpg with pip?: yes
  • Can the issue be reproduced under both asyncio and
    uvloop?
    : n/a

Running pool.acquire() you're returned a PoolAcquireContext , during __aexit__ it calls await self.pool.release(con), which is PoolConnectionHolder.release(timeout=None). This method then performs logic like the following:

...
self._timeout = None
...
budget = timeout  # None
...
await asyncio.wait_for(
    self._con._protocol._wait_for_cancellation(),
    budget, loop=self._pool._loop)
...

This means that if _wait_for_cancellation hangs (which it has in our scenario), there is no way for the user to set a timeout to cancel the cancellation because not only is timeout not passed from the PoolAcquireContext, but also any timeout stored in PoolConnectionHolder is cleared out.

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