Skip to content

Process hangs until SQLiteBackend instance is closed #173

Description

@aaraney

The problem

Process will hang until instance of SQLiteBackend is closed. More specifically, the process will hang until the SQLiteBackend's responses: SQLitePickleCache and redirects: SQLiteCache instance variables are closed. Note, Ive not tested this on other backends.

Expected behavior

Process will exit without explicit close of SQLiteBackend.

Steps to reproduce the behavior

import asyncio
from aiohttp_client_cache import CachedSession, SQLiteBackend

async def hangs_forever():
    cache = SQLiteBackend("test_cache")
    async with CachedSession(cache=cache) as session:
        await session.get("http://httpbin.org/delay/1")
    # await cache.close()


if __name__ == "__main__":
    asyncio.run(hangs_forever())

Workarounds

The only workaround ive found thus far is to explicitly close the SQLiteBackend cache instance (e.g. await cache.close()).

Environment

  • aiohttp-client-cache version: [e.g. 0.8.2]
  • Python version: [e.g. 3.9]
  • Platform: [e.g. macOS Ventura 13.4.1 arm64]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions