Skip to content

inotify leaks #175

@tkukushkin

Description

@tkukushkin

Hello! With the new version of aiodns we've noticed the following warnings:

Failed to create DNS resolver channel with automatic monitoring of resolver configuration changes. This usually means the system ran out of inotify watches. Falling back to socket state callback. Consider increasing the system inotify watch limit: Failed to initialize c-ares channel

Reproducer:

import asyncio, aiodns

async def main():
    while True:
        resolver = aiodns.DNSResolver()
        await resolver.close()

asyncio.run(main())

It seems that closing the resolver doesn't free inotify watches.

In general, the resolver should be created once per application. But we have a lot of legacy code, which creates aiohttp.ClientSession for a single request and then closes it, like this:

async with aiohttp.ClientSession() as session, session.get(...) as response:
   ...

Each time, aiohttp creates a new resolver and then closes it.

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