Skip to content

Memory leak with aiohttp.request #1756

Closed
@ddunlop

Description

Long story short

I'm working on a long running program that makes a significant number of https requests, and the memory of the program increases steadily.

Expected behaviour

I would expect the memory to remain relatively constant.

Actual behaviour

For a sample 500 requests the memory increases approximate 8 meg doing just requests.

Steps to reproduce

import logging
import asyncio
import aiohttp
import gc


async def get():
    response = await aiohttp.request('get', 'https://ddunlop.com')
    logging.info(response.status)
    response.close()


async def main(loop):
    await asyncio.sleep(10)
    for x in range(0, 500):
        await get()

    logging.info('done fetching')
    gc.collect()
    await asyncio.sleep(60)


if __name__ == '__main__':
    logging.getLogger().setLevel('DEBUG')
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main(loop))

Your environment

aiohttp 2.0.2 inside a python:3.6.0-slim docker container.

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions