[GH-ISSUE #905] "proto error" was returned from lookup_ip #561

Closed
opened 2026-03-15 23:09:01 +03:00 by kerem · 27 comments
Owner

Originally created by @zonyitoo on GitHub (Oct 28, 2019).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/905

Describe the bug

I was using AsyncResolver with read_system_conf(). I have got "proto error" when resolving any addresses. Some useful logs are here:

[2019-10-29][00:05:09.424859000][TRACE] [trust_dns_resolver::async_resolver::background] AsyncResolver performing lookup_ip
[2019-10-29][00:05:09.425002000][DEBUG] [trust_dns_proto::xfer::dns_handle] querying: www.example.com A
[2019-10-29][00:05:09.425114000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.141:53), protocol: Udp, tls_dns_name: None, tls_config: None }
[2019-10-29][00:05:09.425175000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.151:53), protocol: Udp, tls_dns_name: None, tls_config: None }
[2019-10-29][00:05:09.425222000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner
[2019-10-29][00:05:09.425247000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Udp { socket_addr: V4(211.148.192.141:53), timeout: 5s }
[2019-10-29][00:05:09.425309000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error
[2019-10-29][00:05:09.425341000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner
[2019-10-29][00:05:09.425362000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Udp { socket_addr: V4(211.148.192.151:53), timeout: 5s }
[2019-10-29][00:05:09.425407000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error
[2019-10-29][00:05:09.434640000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.141:53), protocol: Tcp, tls_dns_name: None, tls_config: None }
[2019-10-29][00:05:09.434720000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.151:53), protocol: Tcp, tls_dns_name: None, tls_config: None }
[2019-10-29][00:05:09.434798000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner
[2019-10-29][00:05:09.434843000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Tcp { socket_addr: V4(211.148.192.141:53), timeout: 5s }
[2019-10-29][00:05:09.434951000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error
[2019-10-29][00:05:09.434986000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner
[2019-10-29][00:05:09.435031000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Tcp { socket_addr: V4(211.148.192.151:53), timeout: 5s }
[2019-10-29][00:05:09.435149000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error
[2019-10-29][00:05:09.435292000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.151:53), protocol: Udp, tls_dns_name: None, tls_config: None }
[2019-10-29][00:05:09.435547000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.141:53), protocol: Udp, tls_dns_name: None, tls_config: None }
[2019-10-29][00:05:09.435617000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner
[2019-10-29][00:05:09.435659000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Udp { socket_addr: V4(211.148.192.151:53), timeout: 5s }
[2019-10-29][00:05:09.435716000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error
[2019-10-29][00:05:09.435769000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner
[2019-10-29][00:05:09.435791000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Udp { socket_addr: V4(211.148.192.141:53), timeout: 5s }
[2019-10-29][00:05:09.435845000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error
[2019-10-29][00:05:09.435942000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.151:53), protocol: Tcp, tls_dns_name: None, tls_config: None }
[2019-10-29][00:05:09.436003000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.141:53), protocol: Tcp, tls_dns_name: None, tls_config: None }
[2019-10-29][00:05:09.436065000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner
[2019-10-29][00:05:09.436107000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Tcp { socket_addr: V4(211.148.192.151:53), timeout: 5s }
[2019-10-29][00:05:09.436214000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error
[2019-10-29][00:05:09.436287000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner
[2019-10-29][00:05:09.436329000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Tcp { socket_addr: V4(211.148.192.141:53), timeout: 5s }
[2019-10-29][00:05:09.436446000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error
[2019-10-29][00:05:09.436542000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.141:53), protocol: Udp, tls_dns_name: None, tls_config: None }
[2019-10-29][00:05:09.436599000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.151:53), protocol: Udp, tls_dns_name: None, tls_config: None }
[2019-10-29][00:05:09.436645000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner
[2019-10-29][00:05:09.436688000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Udp { socket_addr: V4(211.148.192.141:53), timeout: 5s }
[2019-10-29][00:05:09.436740000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error
[2019-10-29][00:05:09.436771000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner
[2019-10-29][00:05:09.436793000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Udp { socket_addr: V4(211.148.192.151:53), timeout: 5s }
[2019-10-29][00:05:09.436887000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error
[2019-10-29][00:05:09.436993000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.141:53), protocol: Tcp, tls_dns_name: None, tls_config: None }
[2019-10-29][00:05:09.437047000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.151:53), protocol: Tcp, tls_dns_name: None, tls_config: None }
[2019-10-29][00:05:09.437115000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner
[2019-10-29][00:05:09.437155000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Tcp { socket_addr: V4(211.148.192.141:53), timeout: 5s }
[2019-10-29][00:05:09.437267000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error
[2019-10-29][00:05:09.437325000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner
[2019-10-29][00:05:09.437362000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Tcp { socket_addr: V4(211.148.192.151:53), timeout: 5s }
[2019-10-29][00:05:09.437464000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error
[2019-10-29][00:05:09.437641000][DEBUG] [trust_dns_proto::xfer::dns_handle] querying: www.example.com AAAA
[2019-10-29][00:05:09.437796000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.151:53), protocol: Udp, tls_dns_name: None, tls_config: None }
[2019-10-29][00:05:09.437854000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.141:53), protocol: Udp, tls_dns_name: None, tls_config: None }
[2019-10-29][00:05:09.437922000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner
[2019-10-29][00:05:09.437952000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Udp { socket_addr: V4(211.148.192.151:53), timeout: 5s }
[2019-10-29][00:05:09.438054000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error
[2019-10-29][00:05:09.438106000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner
[2019-10-29][00:05:09.438137000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Udp { socket_addr: V4(211.148.192.141:53), timeout: 5s }
[2019-10-29][00:05:09.438194000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error
[2019-10-29][00:05:09.438305000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.151:53), protocol: Tcp, tls_dns_name: None, tls_config: None }
[2019-10-29][00:05:09.438365000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.141:53), protocol: Tcp, tls_dns_name: None, tls_config: None }
[2019-10-29][00:05:09.438426000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner
[2019-10-29][00:05:09.438479000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Tcp { socket_addr: V4(211.148.192.151:53), timeout: 5s }
[2019-10-29][00:05:09.438566000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error
[2019-10-29][00:05:09.438608000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner
[2019-10-29][00:05:09.438631000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Tcp { socket_addr: V4(211.148.192.141:53), timeout: 5s }
[2019-10-29][00:05:09.438690000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error
[2019-10-29][00:05:09.438868000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.141:53), protocol: Udp, tls_dns_name: None, tls_config: None }
[2019-10-29][00:05:09.438930000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.151:53), protocol: Udp, tls_dns_name: None, tls_config: None }
[2019-10-29][00:05:09.439010000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner
[2019-10-29][00:05:09.439040000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Udp { socket_addr: V4(211.148.192.141:53), timeout: 5s }
[2019-10-29][00:05:09.439102000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error
[2019-10-29][00:05:09.439136000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner
[2019-10-29][00:05:09.439160000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Udp { socket_addr: V4(211.148.192.151:53), timeout: 5s }
[2019-10-29][00:05:09.439207000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error
[2019-10-29][00:05:09.439297000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.141:53), protocol: Tcp, tls_dns_name: None, tls_config: None }
[2019-10-29][00:05:09.439350000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.151:53), protocol: Tcp, tls_dns_name: None, tls_config: None }
[2019-10-29][00:05:09.439394000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner
[2019-10-29][00:05:09.439418000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Tcp { socket_addr: V4(211.148.192.141:53), timeout: 5s }
[2019-10-29][00:05:09.439479000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error
[2019-10-29][00:05:09.439512000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner
[2019-10-29][00:05:09.439534000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Tcp { socket_addr: V4(211.148.192.151:53), timeout: 5s }
[2019-10-29][00:05:09.439585000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error
[2019-10-29][00:05:09.439683000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.151:53), protocol: Udp, tls_dns_name: None, tls_config: None }
[2019-10-29][00:05:09.439740000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.141:53), protocol: Udp, tls_dns_name: None, tls_config: None }
[2019-10-29][00:05:09.439784000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner
[2019-10-29][00:05:09.439807000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Udp { socket_addr: V4(211.148.192.151:53), timeout: 5s }
[2019-10-29][00:05:09.439859000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error
[2019-10-29][00:05:09.439889000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner
[2019-10-29][00:05:09.439910000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Udp { socket_addr: V4(211.148.192.141:53), timeout: 5s }
[2019-10-29][00:05:09.439954000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error
[2019-10-29][00:05:09.440032000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.151:53), protocol: Tcp, tls_dns_name: None, tls_config: None }
[2019-10-29][00:05:09.440082000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.141:53), protocol: Tcp, tls_dns_name: None, tls_config: None }
[2019-10-29][00:05:09.440128000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner
[2019-10-29][00:05:09.440150000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Tcp { socket_addr: V4(211.148.192.151:53), timeout: 5s }
[2019-10-29][00:05:09.440206000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error
[2019-10-29][00:05:09.440237000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner
[2019-10-29][00:05:09.440258000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Tcp { socket_addr: V4(211.148.192.141:53), timeout: 5s }
[2019-10-29][00:05:09.440308000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error
[2019-10-29][00:05:09.440377000][ERROR] [shadowsocks::relay::dns_resolver] Failed to resolve www.example.com:80, err: proto error

To Reproduce
Steps to reproduce the behavior:

  1. Create a AsyncResolver with read_system_conf

    let (config, opts) = read_system_conf().expect("Failed to read global dns sysconf");
    let (resolver, bg) = AsyncResolver::new(config, opts);
    
    tokio::spawn(bg);  // Runs background task.
    
  2. Call lookup_ip with any addresses

    let addrs = resolver.lookup_ip("www.example.com").await?;
    

Expected behavior

lookup_ip should return valid IPs instead of errors.

System:

  • OS: macOS 10.14.6
  • Architecture: x86_64
  • Version: ?
  • rustc version: 1.39.0-beta.7 (23f8f652b 2019-10-26)

Version:
Crate: resolver
Version: master on github

Originally created by @zonyitoo on GitHub (Oct 28, 2019). Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/905 **Describe the bug** I was using `AsyncResolver` with `read_system_conf()`. I have got "proto error" when resolving any addresses. Some useful logs are here: ``` [2019-10-29][00:05:09.424859000][TRACE] [trust_dns_resolver::async_resolver::background] AsyncResolver performing lookup_ip [2019-10-29][00:05:09.425002000][DEBUG] [trust_dns_proto::xfer::dns_handle] querying: www.example.com A [2019-10-29][00:05:09.425114000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.141:53), protocol: Udp, tls_dns_name: None, tls_config: None } [2019-10-29][00:05:09.425175000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.151:53), protocol: Udp, tls_dns_name: None, tls_config: None } [2019-10-29][00:05:09.425222000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner [2019-10-29][00:05:09.425247000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Udp { socket_addr: V4(211.148.192.141:53), timeout: 5s } [2019-10-29][00:05:09.425309000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error [2019-10-29][00:05:09.425341000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner [2019-10-29][00:05:09.425362000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Udp { socket_addr: V4(211.148.192.151:53), timeout: 5s } [2019-10-29][00:05:09.425407000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error [2019-10-29][00:05:09.434640000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.141:53), protocol: Tcp, tls_dns_name: None, tls_config: None } [2019-10-29][00:05:09.434720000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.151:53), protocol: Tcp, tls_dns_name: None, tls_config: None } [2019-10-29][00:05:09.434798000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner [2019-10-29][00:05:09.434843000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Tcp { socket_addr: V4(211.148.192.141:53), timeout: 5s } [2019-10-29][00:05:09.434951000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error [2019-10-29][00:05:09.434986000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner [2019-10-29][00:05:09.435031000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Tcp { socket_addr: V4(211.148.192.151:53), timeout: 5s } [2019-10-29][00:05:09.435149000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error [2019-10-29][00:05:09.435292000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.151:53), protocol: Udp, tls_dns_name: None, tls_config: None } [2019-10-29][00:05:09.435547000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.141:53), protocol: Udp, tls_dns_name: None, tls_config: None } [2019-10-29][00:05:09.435617000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner [2019-10-29][00:05:09.435659000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Udp { socket_addr: V4(211.148.192.151:53), timeout: 5s } [2019-10-29][00:05:09.435716000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error [2019-10-29][00:05:09.435769000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner [2019-10-29][00:05:09.435791000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Udp { socket_addr: V4(211.148.192.141:53), timeout: 5s } [2019-10-29][00:05:09.435845000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error [2019-10-29][00:05:09.435942000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.151:53), protocol: Tcp, tls_dns_name: None, tls_config: None } [2019-10-29][00:05:09.436003000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.141:53), protocol: Tcp, tls_dns_name: None, tls_config: None } [2019-10-29][00:05:09.436065000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner [2019-10-29][00:05:09.436107000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Tcp { socket_addr: V4(211.148.192.151:53), timeout: 5s } [2019-10-29][00:05:09.436214000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error [2019-10-29][00:05:09.436287000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner [2019-10-29][00:05:09.436329000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Tcp { socket_addr: V4(211.148.192.141:53), timeout: 5s } [2019-10-29][00:05:09.436446000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error [2019-10-29][00:05:09.436542000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.141:53), protocol: Udp, tls_dns_name: None, tls_config: None } [2019-10-29][00:05:09.436599000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.151:53), protocol: Udp, tls_dns_name: None, tls_config: None } [2019-10-29][00:05:09.436645000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner [2019-10-29][00:05:09.436688000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Udp { socket_addr: V4(211.148.192.141:53), timeout: 5s } [2019-10-29][00:05:09.436740000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error [2019-10-29][00:05:09.436771000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner [2019-10-29][00:05:09.436793000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Udp { socket_addr: V4(211.148.192.151:53), timeout: 5s } [2019-10-29][00:05:09.436887000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error [2019-10-29][00:05:09.436993000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.141:53), protocol: Tcp, tls_dns_name: None, tls_config: None } [2019-10-29][00:05:09.437047000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.151:53), protocol: Tcp, tls_dns_name: None, tls_config: None } [2019-10-29][00:05:09.437115000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner [2019-10-29][00:05:09.437155000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Tcp { socket_addr: V4(211.148.192.141:53), timeout: 5s } [2019-10-29][00:05:09.437267000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error [2019-10-29][00:05:09.437325000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner [2019-10-29][00:05:09.437362000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Tcp { socket_addr: V4(211.148.192.151:53), timeout: 5s } [2019-10-29][00:05:09.437464000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error [2019-10-29][00:05:09.437641000][DEBUG] [trust_dns_proto::xfer::dns_handle] querying: www.example.com AAAA [2019-10-29][00:05:09.437796000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.151:53), protocol: Udp, tls_dns_name: None, tls_config: None } [2019-10-29][00:05:09.437854000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.141:53), protocol: Udp, tls_dns_name: None, tls_config: None } [2019-10-29][00:05:09.437922000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner [2019-10-29][00:05:09.437952000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Udp { socket_addr: V4(211.148.192.151:53), timeout: 5s } [2019-10-29][00:05:09.438054000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error [2019-10-29][00:05:09.438106000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner [2019-10-29][00:05:09.438137000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Udp { socket_addr: V4(211.148.192.141:53), timeout: 5s } [2019-10-29][00:05:09.438194000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error [2019-10-29][00:05:09.438305000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.151:53), protocol: Tcp, tls_dns_name: None, tls_config: None } [2019-10-29][00:05:09.438365000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.141:53), protocol: Tcp, tls_dns_name: None, tls_config: None } [2019-10-29][00:05:09.438426000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner [2019-10-29][00:05:09.438479000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Tcp { socket_addr: V4(211.148.192.151:53), timeout: 5s } [2019-10-29][00:05:09.438566000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error [2019-10-29][00:05:09.438608000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner [2019-10-29][00:05:09.438631000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Tcp { socket_addr: V4(211.148.192.141:53), timeout: 5s } [2019-10-29][00:05:09.438690000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error [2019-10-29][00:05:09.438868000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.141:53), protocol: Udp, tls_dns_name: None, tls_config: None } [2019-10-29][00:05:09.438930000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.151:53), protocol: Udp, tls_dns_name: None, tls_config: None } [2019-10-29][00:05:09.439010000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner [2019-10-29][00:05:09.439040000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Udp { socket_addr: V4(211.148.192.141:53), timeout: 5s } [2019-10-29][00:05:09.439102000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error [2019-10-29][00:05:09.439136000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner [2019-10-29][00:05:09.439160000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Udp { socket_addr: V4(211.148.192.151:53), timeout: 5s } [2019-10-29][00:05:09.439207000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error [2019-10-29][00:05:09.439297000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.141:53), protocol: Tcp, tls_dns_name: None, tls_config: None } [2019-10-29][00:05:09.439350000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.151:53), protocol: Tcp, tls_dns_name: None, tls_config: None } [2019-10-29][00:05:09.439394000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner [2019-10-29][00:05:09.439418000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Tcp { socket_addr: V4(211.148.192.141:53), timeout: 5s } [2019-10-29][00:05:09.439479000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error [2019-10-29][00:05:09.439512000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner [2019-10-29][00:05:09.439534000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Tcp { socket_addr: V4(211.148.192.151:53), timeout: 5s } [2019-10-29][00:05:09.439585000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error [2019-10-29][00:05:09.439683000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.151:53), protocol: Udp, tls_dns_name: None, tls_config: None } [2019-10-29][00:05:09.439740000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.141:53), protocol: Udp, tls_dns_name: None, tls_config: None } [2019-10-29][00:05:09.439784000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner [2019-10-29][00:05:09.439807000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Udp { socket_addr: V4(211.148.192.151:53), timeout: 5s } [2019-10-29][00:05:09.439859000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error [2019-10-29][00:05:09.439889000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner [2019-10-29][00:05:09.439910000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Udp { socket_addr: V4(211.148.192.141:53), timeout: 5s } [2019-10-29][00:05:09.439954000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error [2019-10-29][00:05:09.440032000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.151:53), protocol: Tcp, tls_dns_name: None, tls_config: None } [2019-10-29][00:05:09.440082000][DEBUG] [trust_dns_resolver::name_server::name_server] reconnecting: NameServerConfig { socket_addr: V4(211.148.192.141:53), protocol: Tcp, tls_dns_name: None, tls_config: None } [2019-10-29][00:05:09.440128000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner [2019-10-29][00:05:09.440150000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Tcp { socket_addr: V4(211.148.192.151:53), timeout: 5s } [2019-10-29][00:05:09.440206000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error [2019-10-29][00:05:09.440237000][TRACE] [trust_dns_resolver::name_server::connection_provider] polling response inner [2019-10-29][00:05:09.440258000][DEBUG] [trust_dns_resolver::name_server::connection_provider] connecting: Tcp { socket_addr: V4(211.148.192.141:53), timeout: 5s } [2019-10-29][00:05:09.440308000][DEBUG] [trust_dns_resolver::name_server::name_server] name_server connection failure: tokio spawn error [2019-10-29][00:05:09.440377000][ERROR] [shadowsocks::relay::dns_resolver] Failed to resolve www.example.com:80, err: proto error ``` **To Reproduce** Steps to reproduce the behavior: 1. Create a `AsyncResolver` with `read_system_conf` ```rust let (config, opts) = read_system_conf().expect("Failed to read global dns sysconf"); let (resolver, bg) = AsyncResolver::new(config, opts); tokio::spawn(bg); // Runs background task. ``` 2. Call `lookup_ip` with any addresses ```rust let addrs = resolver.lookup_ip("www.example.com").await?; ``` **Expected behavior** `lookup_ip` should return valid IPs instead of errors. **System:** - OS: macOS 10.14.6 - Architecture: x86_64 - Version: ? - rustc version: 1.39.0-beta.7 (23f8f652b 2019-10-26) **Version:** Crate: resolver Version: master on github
kerem closed this issue 2026-03-15 23:09:07 +03:00
Author
Owner

@bluejekyll commented on GitHub (Oct 28, 2019):

Do you have the code for how tokio itself is being instantiated?

<!-- gh-comment-id:547047206 --> @bluejekyll commented on GitHub (Oct 28, 2019): Do you have the code for how tokio itself is being instantiated?
Author
Owner

@bluejekyll commented on GitHub (Oct 28, 2019):

In some of the async/await changes, I think some lazy's were removed, this could be an issue in some cases. Possibly cause the issue your seeing, though I don't see that in any of the tests, which is why I'm wondering how Tokio is being instantiated in your examples.

<!-- gh-comment-id:547185187 --> @bluejekyll commented on GitHub (Oct 28, 2019): In some of the async/await changes, I think some lazy's were removed, this could be an issue in some cases. Possibly cause the issue your seeing, though I don't see that in any of the tests, which is why I'm wondering how Tokio is being instantiated in your examples.
Author
Owner

@zonyitoo commented on GitHub (Oct 29, 2019):

I am using #[tokio::main].

#[tokio::main]
async fn main() {
    // ...
}
<!-- gh-comment-id:547221314 --> @zonyitoo commented on GitHub (Oct 29, 2019): I am using `#[tokio::main]`. ```rust #[tokio::main] async fn main() { // ... } ```
Author
Owner
<!-- gh-comment-id:547222916 --> @zonyitoo commented on GitHub (Oct 29, 2019): This is how I instantiated tokio: https://github.com/shadowsocks/shadowsocks-rust/blob/feature-migrate-async-await/src/bin/server.rs#L25 . In `run_server` function, `AsyncResolver` is instanciated in `Context::new`: https://github.com/shadowsocks/shadowsocks-rust/blob/feature-migrate-async-await/src/relay/server.rs#L18 . `Context::new`: https://github.com/shadowsocks/shadowsocks-rust/blob/feature-migrate-async-await/src/context.rs#L19 . `create_resolver`: https://github.com/shadowsocks/shadowsocks-rust/blob/feature-migrate-async-await/src/relay/dns_resolver.rs#L14
Author
Owner

@bluejekyll commented on GitHub (Oct 29, 2019):

Ok, using this comparison: https://github.com/bluejekyll/trust-dns/compare/4858edd3e74434e21bfa8c1a04b5a2d0459967da...master

My guess is that some of the lazy's that were removed in that patch are causing issues.

update: I looked through both the changes to resolver code and proto code to see if there was a lazy removed that would cause issues, and I don't see it. So I'm not sure that lazy is the issue here.

<!-- gh-comment-id:547435034 --> @bluejekyll commented on GitHub (Oct 29, 2019): Ok, using this comparison: https://github.com/bluejekyll/trust-dns/compare/4858edd3e74434e21bfa8c1a04b5a2d0459967da...master My guess is that some of the lazy's that were removed in that patch are causing issues. update: I looked through both the changes to resolver code and proto code to see if there was a lazy removed that would cause issues, and I don't see it. So I'm not sure that lazy is the issue here.
Author
Owner

@bluejekyll commented on GitHub (Oct 29, 2019):

@zonyitoo if you have time, do you think you could throw together a test case that we can reproduce this problem with and we could use that as the basis for finding this issue and making sure it doesn’t happen again?

<!-- gh-comment-id:547489481 --> @bluejekyll commented on GitHub (Oct 29, 2019): @zonyitoo if you have time, do you think you could throw together a test case that we can reproduce this problem with and we could use that as the basis for finding this issue and making sure it doesn’t happen again?
Author
Owner

@zonyitoo commented on GitHub (Oct 29, 2019):

Minimun test case:

use trust_dns_resolver::AsyncResolver;
use trust_dns_resolver::system_conf::read_system_conf;

use tokio;

#[tokio::main]
async fn main() {
    let (config, opts) = read_system_conf().expect("Failed to read global dns sysconf");
    let (resolver, bg) = AsyncResolver::new(config, opts);

    tokio::spawn(bg);

    let resolved = resolver.lookup_ip("www.example.com").await.unwrap();
    println!("{:?}", resolved);
}

Cargo.toml dependencies:

[dependencies]
trust-dns-resolver = { git = "https://github.com/bluejekyll/trust-dns", features = ["dns-over-rustls", "dns-over-https-rustls"] }
tokio = { git = "https://github.com/tokio-rs/tokio" }

Rust version

rustc 1.40.0-nightly (10a52c25c 2019-10-24)

Build and run with result (with all deps versions):

   Compiling cfg-if v0.1.10
   Compiling spin v0.5.2
   Compiling futures-core-preview v0.3.0-alpha.19
   Compiling futures-sink-preview v0.3.0-alpha.19
   Compiling slab v0.4.2
   Compiling pin-utils v0.1.0-alpha.4
   Compiling futures-io-preview v0.3.0-alpha.19
   Compiling fnv v1.0.6
   Compiling scopeguard v1.0.0
   Compiling smallvec v0.6.11
   Compiling nodrop v0.1.14
   Compiling untrusted v0.7.0
   Compiling matches v0.1.8
   Compiling ppv-lite86 v0.2.6
   Compiling rustc-demangle v0.1.16
   Compiling itoa v0.4.4
   Compiling percent-encoding v2.1.0
   Compiling mime v0.3.14
   Compiling linked-hash-map v0.5.2
   Compiling arc-swap v0.4.3
   Compiling quick-error v1.2.2
   Compiling data-encoding v2.1.2
   Compiling lock_api v0.3.1
   Compiling unicode-bidi v0.3.4
   Compiling lazy_static v1.4.0
   Compiling futures-channel-preview v0.3.0-alpha.19
   Compiling libc v0.2.65
   Compiling memchr v2.2.1
   Compiling byteorder v1.3.2
   Compiling log v0.4.8
   Compiling arrayvec v0.4.12
   Compiling lru-cache v0.1.2
   Compiling crossbeam-utils v0.6.6
   Compiling tracing-core v0.1.7
   Compiling unicode-normalization v0.1.8
   Compiling ring v0.16.9
   Compiling num-traits v0.2.8
   Compiling indexmap v1.3.0
   Compiling futures-util-preview v0.3.0-alpha.19
   Compiling base64 v0.10.1
   Compiling iovec v0.1.4
   Compiling num_cpus v1.10.1
   Compiling net2 v0.2.33
   Compiling getrandom v0.1.13
   Compiling backtrace-sys v0.1.32
   Compiling time v0.1.42
   Compiling socket2 v0.3.11
   Compiling hostname v0.1.5
   Compiling signal-hook-registry v1.1.1
   Compiling memoffset v0.5.1
   Compiling parking_lot_core v0.6.2
   Compiling crossbeam-queue v0.1.2
   Compiling crossbeam-channel v0.3.9
   Compiling bytes v0.4.12
   Compiling c2-chacha v0.2.3
   Compiling rand_core v0.5.1
   Compiling mio v0.6.19
   Compiling backtrace v0.3.40
   Compiling pin-project v0.4.5
   Compiling tracing v0.1.10
   Compiling crossbeam-epoch v0.7.2
   Compiling resolv-conf v0.6.2
   Compiling parking_lot v0.9.0
   Compiling num-integer v0.1.41
   Compiling rand_chacha v0.2.1
   Compiling http v0.1.19
   Compiling string v0.2.1
   Compiling tokio-io v0.2.0-alpha.6
   Compiling failure v0.1.6
   Compiling webpki v0.21.0
   Compiling sct v0.6.0
   Compiling crossbeam-deque v0.7.1
   Compiling rand v0.7.2
   Compiling chrono v0.4.9
   Compiling mio-uds v0.6.7
   Compiling idna v0.2.0
   Compiling rustls v0.16.0
   Compiling webpki-roots v0.18.0
   Compiling tokio-codec v0.2.0-alpha.6
   Compiling url v2.1.0
   Compiling tokio-sync v0.2.0-alpha.6
   Compiling futures-executor-preview v0.3.0-alpha.19
   Compiling tokio-sync v0.2.0-alpha.6 (https://github.com/tokio-rs/tokio#c62ef2d2)
   Compiling futures-preview v0.3.0-alpha.19
   Compiling tokio-executor v0.2.0-alpha.6
   Compiling tokio v0.2.0-alpha.6 (https://github.com/tokio-rs/tokio#c62ef2d2)
   Compiling h2 v0.2.0-alpha.3
   Compiling typed-headers v0.1.1
   Compiling tokio-rustls v0.12.0-alpha.5
   Compiling tokio-timer v0.3.0-alpha.6
   Compiling tokio-net v0.2.0-alpha.6
   Compiling tokio-fs v0.2.0-alpha.6
   Compiling trust-dns-proto v0.18.0-alpha.1 (https://github.com/bluejekyll/trust-dns#7de3f7b7)
   Compiling tokio v0.2.0-alpha.6
   Compiling trust-dns-rustls v0.18.0-alpha.1 (https://github.com/bluejekyll/trust-dns#7de3f7b7)
   Compiling trust-dns-https v0.18.0-alpha.1 (https://github.com/bluejekyll/trust-dns#7de3f7b7)
   Compiling trust-dns-resolver v0.18.0-alpha.1 (https://github.com/bluejekyll/trust-dns#7de3f7b7)
   Compiling test-trust-dns v0.1.0 (/Users/zonyitoo/Desktop/test-trust-dns)
    Finished dev [unoptimized + debuginfo] target(s) in 28.18s
     Running `target/debug/test-trust-dns`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ResolveError { inner: ProtoError { inner: SpawnError { is_shutdown: true }

tokio spawn error }

proto error }', src/libcore/result.rs:1165:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

I can reproduce it everytime on my macbook.

<!-- gh-comment-id:547551561 --> @zonyitoo commented on GitHub (Oct 29, 2019): Minimun test case: ```rust use trust_dns_resolver::AsyncResolver; use trust_dns_resolver::system_conf::read_system_conf; use tokio; #[tokio::main] async fn main() { let (config, opts) = read_system_conf().expect("Failed to read global dns sysconf"); let (resolver, bg) = AsyncResolver::new(config, opts); tokio::spawn(bg); let resolved = resolver.lookup_ip("www.example.com").await.unwrap(); println!("{:?}", resolved); } ``` `Cargo.toml` dependencies: ```toml [dependencies] trust-dns-resolver = { git = "https://github.com/bluejekyll/trust-dns", features = ["dns-over-rustls", "dns-over-https-rustls"] } tokio = { git = "https://github.com/tokio-rs/tokio" } ``` Rust version ``` rustc 1.40.0-nightly (10a52c25c 2019-10-24) ``` Build and run with result (with all deps versions): ``` Compiling cfg-if v0.1.10 Compiling spin v0.5.2 Compiling futures-core-preview v0.3.0-alpha.19 Compiling futures-sink-preview v0.3.0-alpha.19 Compiling slab v0.4.2 Compiling pin-utils v0.1.0-alpha.4 Compiling futures-io-preview v0.3.0-alpha.19 Compiling fnv v1.0.6 Compiling scopeguard v1.0.0 Compiling smallvec v0.6.11 Compiling nodrop v0.1.14 Compiling untrusted v0.7.0 Compiling matches v0.1.8 Compiling ppv-lite86 v0.2.6 Compiling rustc-demangle v0.1.16 Compiling itoa v0.4.4 Compiling percent-encoding v2.1.0 Compiling mime v0.3.14 Compiling linked-hash-map v0.5.2 Compiling arc-swap v0.4.3 Compiling quick-error v1.2.2 Compiling data-encoding v2.1.2 Compiling lock_api v0.3.1 Compiling unicode-bidi v0.3.4 Compiling lazy_static v1.4.0 Compiling futures-channel-preview v0.3.0-alpha.19 Compiling libc v0.2.65 Compiling memchr v2.2.1 Compiling byteorder v1.3.2 Compiling log v0.4.8 Compiling arrayvec v0.4.12 Compiling lru-cache v0.1.2 Compiling crossbeam-utils v0.6.6 Compiling tracing-core v0.1.7 Compiling unicode-normalization v0.1.8 Compiling ring v0.16.9 Compiling num-traits v0.2.8 Compiling indexmap v1.3.0 Compiling futures-util-preview v0.3.0-alpha.19 Compiling base64 v0.10.1 Compiling iovec v0.1.4 Compiling num_cpus v1.10.1 Compiling net2 v0.2.33 Compiling getrandom v0.1.13 Compiling backtrace-sys v0.1.32 Compiling time v0.1.42 Compiling socket2 v0.3.11 Compiling hostname v0.1.5 Compiling signal-hook-registry v1.1.1 Compiling memoffset v0.5.1 Compiling parking_lot_core v0.6.2 Compiling crossbeam-queue v0.1.2 Compiling crossbeam-channel v0.3.9 Compiling bytes v0.4.12 Compiling c2-chacha v0.2.3 Compiling rand_core v0.5.1 Compiling mio v0.6.19 Compiling backtrace v0.3.40 Compiling pin-project v0.4.5 Compiling tracing v0.1.10 Compiling crossbeam-epoch v0.7.2 Compiling resolv-conf v0.6.2 Compiling parking_lot v0.9.0 Compiling num-integer v0.1.41 Compiling rand_chacha v0.2.1 Compiling http v0.1.19 Compiling string v0.2.1 Compiling tokio-io v0.2.0-alpha.6 Compiling failure v0.1.6 Compiling webpki v0.21.0 Compiling sct v0.6.0 Compiling crossbeam-deque v0.7.1 Compiling rand v0.7.2 Compiling chrono v0.4.9 Compiling mio-uds v0.6.7 Compiling idna v0.2.0 Compiling rustls v0.16.0 Compiling webpki-roots v0.18.0 Compiling tokio-codec v0.2.0-alpha.6 Compiling url v2.1.0 Compiling tokio-sync v0.2.0-alpha.6 Compiling futures-executor-preview v0.3.0-alpha.19 Compiling tokio-sync v0.2.0-alpha.6 (https://github.com/tokio-rs/tokio#c62ef2d2) Compiling futures-preview v0.3.0-alpha.19 Compiling tokio-executor v0.2.0-alpha.6 Compiling tokio v0.2.0-alpha.6 (https://github.com/tokio-rs/tokio#c62ef2d2) Compiling h2 v0.2.0-alpha.3 Compiling typed-headers v0.1.1 Compiling tokio-rustls v0.12.0-alpha.5 Compiling tokio-timer v0.3.0-alpha.6 Compiling tokio-net v0.2.0-alpha.6 Compiling tokio-fs v0.2.0-alpha.6 Compiling trust-dns-proto v0.18.0-alpha.1 (https://github.com/bluejekyll/trust-dns#7de3f7b7) Compiling tokio v0.2.0-alpha.6 Compiling trust-dns-rustls v0.18.0-alpha.1 (https://github.com/bluejekyll/trust-dns#7de3f7b7) Compiling trust-dns-https v0.18.0-alpha.1 (https://github.com/bluejekyll/trust-dns#7de3f7b7) Compiling trust-dns-resolver v0.18.0-alpha.1 (https://github.com/bluejekyll/trust-dns#7de3f7b7) Compiling test-trust-dns v0.1.0 (/Users/zonyitoo/Desktop/test-trust-dns) Finished dev [unoptimized + debuginfo] target(s) in 28.18s Running `target/debug/test-trust-dns` thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ResolveError { inner: ProtoError { inner: SpawnError { is_shutdown: true } tokio spawn error } proto error }', src/libcore/result.rs:1165:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace. ``` I can reproduce it everytime on my macbook.
Author
Owner

@bluejekyll commented on GitHub (Oct 29, 2019):

Ok, thanks. I'll pull this into the repo and use as a new test case to make sure we're compatible with the usage of #[tokio::main], my theory is that something is not as lazy as it should be during construction, but not sure why it's different based on the way tokio is instantiated.

I might have time to look at this tonight, but can't guarantee it.

<!-- gh-comment-id:547554302 --> @bluejekyll commented on GitHub (Oct 29, 2019): Ok, thanks. I'll pull this into the repo and use as a new test case to make sure we're compatible with the usage of `#[tokio::main]`, my theory is that something is not as lazy as it should be during construction, but not sure why it's different based on the way tokio is instantiated. I might have time to look at this tonight, but can't guarantee it.
Author
Owner

@zonyitoo commented on GitHub (Oct 29, 2019):

I don't think #[tokio::main] is the one to be blamed. Here is another test case with Runtime:

use trust_dns_resolver::AsyncResolver;
use trust_dns_resolver::system_conf::read_system_conf;

use tokio;
use tokio::runtime::Runtime;

fn main() {
    let runtime = Runtime::new().unwrap();

    let resolved = runtime.block_on(async {
        let (config, opts) = read_system_conf().expect("Failed to read global dns sysconf");
        let (resolver, bg) = AsyncResolver::new(config, opts);

        tokio::spawn(bg);

        resolver.lookup_ip("www.example.com").await
    }).unwrap();

    println!("{:?}", resolved);
}

I can get exactly the same result:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ResolveError { inner: ProtoError { inner: SpawnError { is_shutdown: true }

tokio spawn error }

proto error }', src/libcore/result.rs:1165:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
<!-- gh-comment-id:547556837 --> @zonyitoo commented on GitHub (Oct 29, 2019): I don't think `#[tokio::main]` is the one to be blamed. Here is another test case with `Runtime`: ```rust use trust_dns_resolver::AsyncResolver; use trust_dns_resolver::system_conf::read_system_conf; use tokio; use tokio::runtime::Runtime; fn main() { let runtime = Runtime::new().unwrap(); let resolved = runtime.block_on(async { let (config, opts) = read_system_conf().expect("Failed to read global dns sysconf"); let (resolver, bg) = AsyncResolver::new(config, opts); tokio::spawn(bg); resolver.lookup_ip("www.example.com").await }).unwrap(); println!("{:?}", resolved); } ``` I can get exactly the same result: ``` thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ResolveError { inner: ProtoError { inner: SpawnError { is_shutdown: true } tokio spawn error } proto error }', src/libcore/result.rs:1165:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace. ```
Author
Owner

@zonyitoo commented on GitHub (Oct 29, 2019):

This is exactly the test in async_resolver/mod.rs.

use trust_dns_resolver::config::{ResolverConfig, ResolverOpts};
use trust_dns_resolver::AsyncResolver;

use tokio::runtime::Runtime;

fn main() {
    let runtime = Runtime::new().unwrap();

    let (resolver, bg) = AsyncResolver::new(ResolverConfig::default(), ResolverOpts::default());

    runtime.spawn(bg);

    let resolved = runtime.block_on(resolver.lookup_ip("www.example.com")).unwrap();
    println!("{:?}", resolved);
}

Not surprised ...

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ResolveError { inner: ProtoError { inner: SpawnError { is_shutdown: true }

tokio spawn error }

proto error }', src/libcore/result.rs:1165:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
<!-- gh-comment-id:547561147 --> @zonyitoo commented on GitHub (Oct 29, 2019): This is exactly the test in [async_resolver/mod.rs](https://github.com/bluejekyll/trust-dns/blob/master/crates/resolver/src/async_resolver/mod.rs#L422). ```rust use trust_dns_resolver::config::{ResolverConfig, ResolverOpts}; use trust_dns_resolver::AsyncResolver; use tokio::runtime::Runtime; fn main() { let runtime = Runtime::new().unwrap(); let (resolver, bg) = AsyncResolver::new(ResolverConfig::default(), ResolverOpts::default()); runtime.spawn(bg); let resolved = runtime.block_on(resolver.lookup_ip("www.example.com")).unwrap(); println!("{:?}", resolved); } ``` Not surprised ... ``` thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ResolveError { inner: ProtoError { inner: SpawnError { is_shutdown: true } tokio spawn error } proto error }', src/libcore/result.rs:1165:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace. ```
Author
Owner

@bluejekyll commented on GitHub (Oct 29, 2019):

I don't think #[tokio::main] is the one to be blamed. Here is another test case with Runtime:

I wasn't implying it's at fault, just that it's exposing an issue in the library that wasn't there before.

What's confusing here is that this test passes in CI without issue, and on mac (also locally for me as well): https://travis-ci.org/bluejekyll/trust-dns/jobs/604008906#L827 (edit: had link to wrong line before)

I wonder if we're masking some other error?

<!-- gh-comment-id:547570161 --> @bluejekyll commented on GitHub (Oct 29, 2019): > I don't think #[tokio::main] is the one to be blamed. Here is another test case with Runtime: I wasn't implying it's at fault, just that it's exposing an issue in the library that wasn't there before. What's confusing here is that this test passes in CI without issue, and on mac (also locally for me as well): https://travis-ci.org/bluejekyll/trust-dns/jobs/604008906#L827 (edit: had link to wrong line before) I wonder if we're masking some other error?
Author
Owner

@bluejekyll commented on GitHub (Oct 30, 2019):

Ok, here's why the tests are passing, change your dependency on tokio to tokio = "0.2.0-alpha", and your example passes.

So something about tokio master is different enough to break trust-dns.

<!-- gh-comment-id:547733186 --> @bluejekyll commented on GitHub (Oct 30, 2019): Ok, here's why the tests are passing, change your dependency on tokio to `tokio = "0.2.0-alpha"`, and your example passes. So something about tokio master is different enough to break trust-dns.
Author
Owner

@bluejekyll commented on GitHub (Oct 30, 2019):

Ok, see feedback on linked issue. After looking at the cargo tree output, I think it's clear that there are multiple dependency versions being used at once from tokio. Please use 0.2.0-alpha from tokio, and most likely, it might be best to use the latest 0.18.0-alpha for trust-dns as well.

<!-- gh-comment-id:547740960 --> @bluejekyll commented on GitHub (Oct 30, 2019): Ok, see feedback on linked issue. After looking at the cargo tree output, I think it's clear that there are multiple dependency versions being used at once from tokio. Please use `0.2.0-alpha` from tokio, and most likely, it might be best to use the latest 0.18.0-alpha for trust-dns as well.
Author
Owner

@zonyitoo commented on GitHub (Oct 30, 2019):

Well, it works after changing deps of tokio.

<!-- gh-comment-id:547857986 --> @zonyitoo commented on GitHub (Oct 30, 2019): Well, it works after changing deps of `tokio`.
Author
Owner

@zonyitoo commented on GitHub (Oct 30, 2019):

Closing now.

<!-- gh-comment-id:547858426 --> @zonyitoo commented on GitHub (Oct 30, 2019): Closing now.
Author
Owner

@bluejekyll commented on GitHub (Oct 30, 2019):

If you want to use master, you’ll need do something to tell all the trust-dns libraries to also use master, it is possible: https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#overriding-dependencies

<!-- gh-comment-id:547897168 --> @bluejekyll commented on GitHub (Oct 30, 2019): If you want to use master, you’ll need do something to tell all the trust-dns libraries to also use master, it is possible: https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#overriding-dependencies
Author
Owner

@zonyitoo commented on GitHub (Oct 30, 2019):

That's very helpful!! Thanks!

<!-- gh-comment-id:547897696 --> @zonyitoo commented on GitHub (Oct 30, 2019): That's very helpful!! Thanks!
Author
Owner

@zonyitoo commented on GitHub (Oct 30, 2019):

But it seems that trust-dns cannot build with tokio's master

   Compiling trust-dns-proto v0.18.0-alpha.1 (https://github.com/bluejekyll/trust-dns#7de3f7b7)
error[E0432]: unresolved import `tokio_net::tcp`
   --> /Users/zonyitoo/.cargo/git/checkouts/trust-dns-97a7602ad159d348/7de3f7b/crates/proto/src/tcp/tcp_client_stream.rs:128:16
    |
128 | use tokio_net::tcp::TcpStream as TokioTcpStream;
    |                ^^^ could not find `tcp` in `tokio_net`

error[E0432]: unresolved import `tokio_net::udp`
   --> /Users/zonyitoo/.cargo/git/checkouts/trust-dns-97a7602ad159d348/7de3f7b/crates/proto/src/udp/udp_stream.rs:316:5
    |
316 | use tokio_net::udp;
    |     ^^^^^^^^^^^^^^ no `udp` in the root

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0432`.
error: could not compile `trust-dns-proto`.
warning: build failed, waiting for other jobs to finish...
error: build failed
<!-- gh-comment-id:547899174 --> @zonyitoo commented on GitHub (Oct 30, 2019): But it seems that trust-dns cannot build with tokio's master ``` Compiling trust-dns-proto v0.18.0-alpha.1 (https://github.com/bluejekyll/trust-dns#7de3f7b7) error[E0432]: unresolved import `tokio_net::tcp` --> /Users/zonyitoo/.cargo/git/checkouts/trust-dns-97a7602ad159d348/7de3f7b/crates/proto/src/tcp/tcp_client_stream.rs:128:16 | 128 | use tokio_net::tcp::TcpStream as TokioTcpStream; | ^^^ could not find `tcp` in `tokio_net` error[E0432]: unresolved import `tokio_net::udp` --> /Users/zonyitoo/.cargo/git/checkouts/trust-dns-97a7602ad159d348/7de3f7b/crates/proto/src/udp/udp_stream.rs:316:5 | 316 | use tokio_net::udp; | ^^^^^^^^^^^^^^ no `udp` in the root error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0432`. error: could not compile `trust-dns-proto`. warning: build failed, waiting for other jobs to finish... error: build failed ```
Author
Owner

@zonyitoo commented on GitHub (Oct 30, 2019):

These two errors could be fixed by replacing tokio_net with tokio::net.

<!-- gh-comment-id:547902182 --> @zonyitoo commented on GitHub (Oct 30, 2019): These two errors could be fixed by replacing `tokio_net` with `tokio::net`.
Author
Owner

@bluejekyll commented on GitHub (Oct 30, 2019):

We don’t want to directly depend on Tokio, as that pulls in too many dependencies for the proto library. Did you override the version dependency for all of the Tokio child libraries?

<!-- gh-comment-id:547935520 --> @bluejekyll commented on GitHub (Oct 30, 2019): We don’t want to directly depend on Tokio, as that pulls in too many dependencies for the proto library. Did you override the version dependency for all of the Tokio child libraries?
Author
Owner

@zonyitoo commented on GitHub (Oct 30, 2019):

I don't think that will work. Some of the child libraries have been merged completely into tokio, such as tokio-process, tokio-signal, tokio-io, tokio-net, tokio-executor ...

<!-- gh-comment-id:548028797 --> @zonyitoo commented on GitHub (Oct 30, 2019): I don't think that will work. Some of the child libraries have been merged completely into `tokio`, such as `tokio-process`, `tokio-signal`, `tokio-io`, `tokio-net`, `tokio-executor` ...
Author
Owner

@cg31 commented on GitHub (Nov 19, 2019):

sub crate tokio-net was removed in tokio trunk:
github.com/tokio-rs/tokio@227533d456 (diff-35f6180221)

<!-- gh-comment-id:555381686 --> @cg31 commented on GitHub (Nov 19, 2019): sub crate tokio-net was removed in tokio trunk: https://github.com/tokio-rs/tokio/commit/227533d456fe32e48ffcd3796f1e6c8f9318b230#diff-35f61802211c050cff4d28bd6cd086e0
Author
Owner

@bluejekyll commented on GitHub (Nov 19, 2019):

Thanks for this note. I’m going to ping the Tokio dev channel to get some guidance.

<!-- gh-comment-id:555594528 --> @bluejekyll commented on GitHub (Nov 19, 2019): Thanks for this note. I’m going to ping the Tokio dev channel to get some guidance.
Author
Owner

@zonyitoo commented on GitHub (Nov 26, 2019):

Remind: tokio v0.2.0 is released.

<!-- gh-comment-id:558744446 --> @zonyitoo commented on GitHub (Nov 26, 2019): Remind: tokio v0.2.0 is released.
Author
Owner

@kpcyrd commented on GitHub (Mar 18, 2020):

I think I ran into the same issue after upgrading from osx 10.12 to 10.13. I'm on trust-dns 0.17.0 and trust-dns-proto 0.8.0.

Removing the fe80::/10 address from /etc/resolv.conf fixed this. I assume this error might be related to ipv6.

<!-- gh-comment-id:600398993 --> @kpcyrd commented on GitHub (Mar 18, 2020): I think I ran into the same issue after upgrading from osx 10.12 to 10.13. I'm on trust-dns 0.17.0 and trust-dns-proto 0.8.0. Removing the fe80::/10 address from /etc/resolv.conf fixed this. I assume this error might be related to ipv6.
Author
Owner

@bluejekyll commented on GitHub (Mar 18, 2020):

Any chance you can upgrade to 0.19?

<!-- gh-comment-id:600400533 --> @bluejekyll commented on GitHub (Mar 18, 2020): Any chance you can upgrade to 0.19?
Author
Owner

@zonyitoo commented on GitHub (Mar 18, 2020):

Already upgraded. But found another warnings:

[2020-03-17T19:55:54Z WARN  trust_dns_proto::xfer] error notifying wait, possible future leak: Err(ProtoError { kind: Message("requestor canceled"), backtrack: None })

But errors in this issue is not showing again.

<!-- gh-comment-id:600402658 --> @zonyitoo commented on GitHub (Mar 18, 2020): Already upgraded. But found another warnings: ``` [2020-03-17T19:55:54Z WARN trust_dns_proto::xfer] error notifying wait, possible future leak: Err(ProtoError { kind: Message("requestor canceled"), backtrack: None }) ``` But errors in this issue is not showing again.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hickory-dns#561
No description provided.