gevent.resolver.thread – thread based hostname resolver#

Native thread-based hostname resolver.

class Resolver(hub=None)[source]#

Bases: object

Implementation of the resolver API using native threads and native resolution functions.

Using the native resolution mechanisms ensures the highest compatibility with what a non-gevent program would return including good support for platform specific configuration mechanisms. The use of native (non-greenlet) threads ensures that a caller doesn’t block other greenlets.

This implementation also has the benefit of being very simple in comparison to gevent.resolver_ares.Resolver.


Most users find this resolver to be quite reliable in a properly monkey-patched environment. However, there have been some reports of long delays, slow performance or even hangs, particularly in long-lived programs that make many, many DNS requests. If you suspect that may be happening to you, try the dnspython or ares resolver (and submit a bug report).