Skip to main content

SHARED_LOOKUPS

Constant SHARED_LOOKUPS 

Source
pub const SHARED_LOOKUPS: usize = 128;
Expand description

Name lookups the whole process may have in flight beyond the one every connection keeps in reserve.

The number this bounds is threads, not queries: tokio::net::lookup_host hands a name to getaddrinfo on the runtime’s blocking pool, and that call is not cancellable. A connect_timeout that expires drops the future and answers the client, but the thread stays in the resolver until the stub gives up on its own — five seconds per attempt on a stock resolv.conf, tens of seconds where the nameserver answers nothing at all. So an unbounded proxy converts one client’s black-holed names directly into parked threads, and the pool is process-wide: with the default max_connections x max_targets_per_conn at 65 536 in-flight requests against tokio’s 512 threads, two connections’ worth of hung lookups leave every other connection’s resolution waiting for a thread, including names that never needed the resolver at all (D90).