Skip to content

Async networking and blocking host name resolving / DNS #7422

@zevv

Description

@zevv

I believe the current mechanism used for hostname lookups interferes with truly asynchronous networking. The async dial() ends up using the getaddrinfo() C library call, which can show serious blocking behaviour.

This is a common problem in network programming, with no obvious solutions, but it would be nice to offer a truly async experience for the Nim user without unexpected blocking when doing high level networking, like AsyncHttpClient.

Some ideas:

  • Can Nim wrap the getaddrinfo() call in a separate thread to do the lookups? This requires threading to be enabled, obviously
  • Should Nim implement (a subset of) getaddrinfo() asynchronously in pure Nim?
  • Should Nim be able to rely on an external library for lookups, like libc-ares?

Metadata

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