Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client sessions are not closed on client close #588

Open
mbrancato opened this issue Feb 24, 2023 · 0 comments
Open

Client sessions are not closed on client close #588

mbrancato opened this issue Feb 24, 2023 · 0 comments

Comments

@mbrancato
Copy link

The aiohttp.ClientSession is not closed properly after close() is called on a client.

e.g.

import aiohttp
import logging

from gcloud.aio.pubsub import PublisherClient

logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger("test")

async def foo():
    pubsub_conn = aiohttp.TCPConnector(limit=50)
    pubsub_session = aiohttp.ClientSession(connector=pubsub_conn)
    pubsub_client = PublisherClient(session=pubsub_session)
    logger.info("done")
    await pubsub_client.close()


asyncio.run(foo())
DEBUG:asyncio:Using selector: KqueueSelector
INFO:test:done
ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x107ea8460>

The only way I've been able to avoid these is to explicitly call await pubsub_session.close() or by calling await pubsub_client.session.session.close().

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

No branches or pull requests

1 participant