[GH-ISSUE #692] Memory leak in Trust-DNS client when used in Windows #273

Closed
opened 2026-03-07 23:09:59 +03:00 by kerem · 10 comments
Owner

Originally created by @oherrala on GitHub (Feb 21, 2019).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/692

Describe the bug

Using Trust-DNS client to do a DNS queries in Windows leaks memory causing long running processes to bloat their heap.

To Reproduce

The following code can be used to cause easily observable memory leak in Windows (Windows 10, 10.0.17134 Build 17134). Running it shows memory usage of 72 MB on my test system. Tested with both trust-dns versions 0.15.1 and 0.16.0-alpha.2. Dr. Memory leak detector output below.

Replace the IP address with proper DNS server in sample code to get it running.

[package]
name = "mio-mao"
version = "0.1.0"
authors = ["Ossi Herrala <oherrala@iki.fi>"]
edition = "2018"

[dependencies]
trust-dns = "*"
use std::io;
use std::net::{SocketAddr, Ipv4Addr};
use std::thread::sleep_ms;
use std::str::FromStr;

use trust_dns::client::{Client, SyncClient};
use trust_dns::rr::{DNSClass, Name, RecordType};
use trust_dns::udp::UdpClientConnection;

fn main() -> io::Result<()> {
    let ip = Ipv4Addr::new(192,168,1,1);
    let port = 53;
    let conn = UdpClientConnection::new(SocketAddr::from((ip, port)))?;
    let client = SyncClient::new(conn);    
    let name = Name::from_str("example.com")?;

    for _ in 0..=1024 {
        match client.query(&name, DNSClass::IN, RecordType::A) {
            Ok(resp) => println!("DNS response: {:?}", resp),
            Err(err) => println!("DNS query failed: {}", err),
        };
    }

    sleep_ms(100_000);

    Ok(())
}

Expected behavior

Allocated memory should be freed after it's no longer needed.

System:

  • OS: Windows
  • Architecture: amd64
  • Version: 10
  • rustc version: 1.32.0

Version:
Crate: trust-dns
Version: 0.15.1 and 0.16.0-alpha.2

Additional context

A full Dr. Memory memory leak output:

Dr. Memory version 1.11.0 build 2 built on Aug 29 2016 02:41:18
Dr. Memory results for pid 6352: "mio-mao.exe"
Application cmdline: "C:\Users\IEUser\AppData\Local\Temp\cargo\debug\mio-mao.exe"
Recorded 115 suppression(s) from default C:\Program Files (x86)\Dr. Memory\bin64\suppress-default.txt

Error #1: LEAK 352 direct bytes 0x0000028d9a8f0870-0x0000028d9a8f09d0 + 143824 indirect bytes
# 0 replace_RtlAllocateHeap                                            [d:\drmemory_package\common\alloc_replace.c:3770]
# 1 core::mem::swap<>                                                  [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\mem.rs:621]
# 2 core::option::{{impl}}::next<>                                     [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\option.rs:1101]
# 3 core::cell::UnsafeCell<>::new<>                                    [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\cell.rs:1471]
# 4 std::alloc::__default_lib_allocator::__rdl_alloc                   [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\alloc.rs:243]
# 5 alloc::alloc::alloc                                                [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:82]
# 6 alloc::alloc::exchange_malloc                                      [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:192]
# 7 core::sync::atomic::AtomicUsize::new                               [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\sync\atomic.rs:1158]
# 8 mio::sys::windows::from_raw_arc::FromRawArc<>::new<>               [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\sys\windows\from_raw_arc.rs:41]
# 9 mio::sys::windows::udp::UdpSocket::new                             [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\sys\windows\udp.rs:61]
#10 KERNELBASE.dll!WaitForSingleObjectEx                              +0xa1     (0x00007ff94af89252 <KERNELBASE.dll+0x39252>)
#11 core::ptr::swap_nonoverlapping_bytes                               [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\ptr.rs:426]

Error #2: LEAK 88 direct bytes 0x0000028d9a8f24a0-0x0000028d9a8f24f8 + 72040 indirect bytes
# 0 replace_RtlAllocateHeap                                        [d:\drmemory_package\common\alloc_replace.c:3770]
# 1 std::alloc::__default_lib_allocator::__rdl_alloc               [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\alloc.rs:243]
# 2 alloc::alloc::alloc                                            [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:82]
# 3 std::alloc::__default_lib_allocator::__rdl_alloc               [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\alloc.rs:243]
# 4 alloc::alloc::alloc                                            [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:82]
# 5 alloc::alloc::exchange_malloc                                  [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:192]
# 6 std::sync::mutex::Mutex<>::new<>                               [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libstd\sync\mutex.rs:185]
# 7 alloc::sync::Arc<>::new<>                                      [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\sync.rs:298]
# 8 mio::sys::windows::awakener::Awakener::new                     [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\sys\windows\awakener.rs:20]
# 9 core::sync::atomic::AtomicPtr<>::new<>                         [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\sync\atomic.rs:775]
#10 core::result::{{impl}}::into_result<>                          [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\result.rs:1265]
#11 mio::poll::ReadinessQueue::new                                 [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\poll.rs:2103]

Error #3: LEAK 64 direct bytes 0x0000028d9a8f9270-0x0000028d9a8f92b0 + 72128 indirect bytes
# 0 replace_RtlAllocateHeap                                          [d:\drmemory_package\common\alloc_replace.c:3770]
# 1 core::convert::{{impl}}::into<>                                  [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\convert.rs:455]
# 2 mio::poll::ReadinessState::new                                   [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\poll.rs:2580]
# 3 trust_dns_proto::rr::domain::name::{{impl}}::clone               [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\trust-dns-proto-0.7.1\src\rr\domain\name.rs:31]
# 4 core::sync::atomic::AtomicUsize::new                             [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\sync\atomic.rs:1158]
# 5 mio::poll::AtomicState::new                                      [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\poll.rs:2551]
# 6 core::sync::atomic::AtomicUsize::new                             [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\sync\atomic.rs:1158]
# 7 std::alloc::__default_lib_allocator::__rdl_alloc                 [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\alloc.rs:243]
# 8 mio::poll::ReadinessNode::marker                                 [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\poll.rs:2493]
# 9 alloc::alloc::alloc                                              [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:82]
#10 alloc::alloc::exchange_malloc                                    [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:192]
#11 mio::poll::ReadinessQueue::new                                   [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\poll.rs:2097]

Error #4: POSSIBLE LEAK 88 direct bytes 0x0000028d9a9238c0-0x0000028d9a923918 + 72040 indirect bytes
# 0 replace_RtlAllocateHeap                                        [d:\drmemory_package\common\alloc_replace.c:3770]
# 1 std::alloc::__default_lib_allocator::__rdl_alloc               [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\alloc.rs:243]
# 2 alloc::alloc::alloc                                            [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:82]
# 3 std::alloc::__default_lib_allocator::__rdl_alloc               [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\alloc.rs:243]
# 4 alloc::alloc::alloc                                            [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:82]
# 5 alloc::alloc::exchange_malloc                                  [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:192]
# 6 std::sync::mutex::Mutex<>::new<>                               [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libstd\sync\mutex.rs:185]
# 7 alloc::sync::Arc<>::new<>                                      [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\sync.rs:298]
# 8 mio::sys::windows::awakener::Awakener::new                     [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\sys\windows\awakener.rs:20]
# 9 core::sync::atomic::AtomicPtr<>::new<>                         [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\sync\atomic.rs:775]
#10 core::result::{{impl}}::into_result<>                          [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\result.rs:1265]
#11 mio::poll::ReadinessQueue::new                                 [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\poll.rs:2103]

Error #5: LEAK 16 direct bytes 0x0000028d9a92f2b0-0x0000028d9a92f2c0 + 0 indirect bytes
# 0 replace_RtlAllocateHeap                                          [d:\drmemory_package\common\alloc_replace.c:3770]
# 1 alloc::vec::{{impl}}::clone<>                                    [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\vec.rs:1615]
# 2 std::alloc::__default_lib_allocator::__rdl_alloc                 [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\alloc.rs:243]
# 3 alloc::alloc::alloc                                              [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:82]
# 4 alloc::alloc::exchange_malloc                                    [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:192]
# 5 trust_dns_proto::rr::domain::name::{{impl}}::clone               [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\trust-dns-proto-0.7.1\src\rr\domain\name.rs:31]
# 6 core::sync::atomic::AtomicUsize::new                             [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\sync\atomic.rs:1158]
# 7 std::sync::mutex::Mutex<>::new<>                                 [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libstd\sync\mutex.rs:180]
# 8 core::sync::atomic::AtomicUsize::new                             [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\sync\atomic.rs:1158]
# 9 alloc::alloc::alloc                                              [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:82]
#10 mio::sys::windows::awakener::Awakener::new                       [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\sys\windows\awakener.rs:20]
#11 mio::poll::ReadinessQueue::new                                   [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\poll.rs:2104]

Error #6: LEAK 352 direct bytes 0x0000028d9a961670-0x0000028d9a9617d0 + 143760 indirect bytes
# 0 replace_RtlAllocateHeap                                            [d:\drmemory_package\common\alloc_replace.c:3770]
# 1 core::cell::UnsafeCell<>::new<>                                    [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\cell.rs:1471]
# 2 std::alloc::__default_lib_allocator::__rdl_alloc                   [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\alloc.rs:243]
# 3 alloc::alloc::alloc                                                [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:82]
# 4 alloc::alloc::exchange_malloc                                      [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:192]
# 5 core::sync::atomic::AtomicUsize::new                               [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\sync\atomic.rs:1158]
# 6 mio::sys::windows::from_raw_arc::FromRawArc<>::new<>               [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\sys\windows\from_raw_arc.rs:41]
# 7 mio::sys::windows::udp::UdpSocket::new                             [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\sys\windows\udp.rs:61]
# 8 KERNELBASE.dll!WaitForSingleObjectEx                              +0xa1     (0x00007ff94af89252 <KERNELBASE.dll+0x39252>)
# 9 core::ptr::swap_nonoverlapping_bytes                               [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\ptr.rs:426]
#10 core::ptr::swap_nonoverlapping<>                                   [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\ptr.rs:362]
#11 core::ptr::swap_nonoverlapping_bytes                               [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\ptr.rs:426]

Error #7: LEAK 352 direct bytes 0x0000028d9a98b410-0x0000028d9a98b570 + 72208 indirect bytes
# 0 replace_RtlAllocateHeap                                                    [d:\drmemory_package\common\alloc_replace.c:3770]
# 1 core::mem::swap<>                                                          [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\mem.rs:621]
# 2 core::option::{{impl}}::next<>                                             [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\option.rs:1101]
# 3 core::cell::UnsafeCell<>::new<>                                            [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\cell.rs:1471]
# 4 std::alloc::__default_lib_allocator::__rdl_alloc                           [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\alloc.rs:243]
# 5 alloc::alloc::alloc                                                        [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:82]
# 6 alloc::alloc::exchange_malloc                                              [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:192]
# 7 core::sync::atomic::AtomicUsize::new                                       [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\sync\atomic.rs:1158]
# 8 mio::sys::windows::from_raw_arc::FromRawArc<>::new<>                       [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\sys\windows\from_raw_arc.rs:41]
# 9 mio::sys::windows::udp::UdpSocket::new                                     [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\sys\windows\udp.rs:61]
#10 mio::net::udp::UdpSocket::from_socket                                      [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\net\udp.rs:139]
#11 core::ops::function::FnOnce::call_once<> std::net::udp::UdpSocket,(std::sys_common::net::UdpSocket)> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\ops\function.rs:238]

Error #8: POSSIBLE LEAK 352 direct bytes 0x0000028d9ac10020-0x0000028d9ac10180 + 71784 indirect bytes
# 0 replace_RtlAllocateHeap                                                    [d:\drmemory_package\common\alloc_replace.c:3770]
# 1 core::mem::swap<>                                                          [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\mem.rs:621]
# 2 core::option::{{impl}}::next<>                                             [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\option.rs:1101]
# 3 core::cell::UnsafeCell<>::new<>                                            [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\cell.rs:1471]
# 4 std::alloc::__default_lib_allocator::__rdl_alloc                           [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\alloc.rs:243]
# 5 alloc::alloc::alloc                                                        [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:82]
# 6 alloc::alloc::exchange_malloc                                              [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:192]
# 7 core::sync::atomic::AtomicUsize::new                                       [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\sync\atomic.rs:1158]
# 8 mio::sys::windows::from_raw_arc::FromRawArc<>::new<>                       [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\sys\windows\from_raw_arc.rs:41]
# 9 mio::sys::windows::udp::UdpSocket::new                                     [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\sys\windows\udp.rs:61]
#10 mio::net::udp::UdpSocket::from_socket                                      [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\net\udp.rs:139]
#11 core::ops::function::FnOnce::call_once<> std::net::udp::UdpSocket,(std::sys_common::net::UdpSocket)> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\ops\function.rs:238]

Error #9: POSSIBLE LEAK 352 direct bytes 0x0000028d9acb0bd0-0x0000028d9acb0d30 + 72144 indirect bytes
# 0 replace_RtlAllocateHeap                                            [d:\drmemory_package\common\alloc_replace.c:3770]
# 1 core::mem::swap<>                                                  [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\mem.rs:621]
# 2 core::option::{{impl}}::next<>                                     [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\option.rs:1101]
# 3 core::cell::UnsafeCell<>::new<>                                    [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\cell.rs:1471]
# 4 std::alloc::__default_lib_allocator::__rdl_alloc                   [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\alloc.rs:243]
# 5 alloc::alloc::alloc                                                [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:82]
# 6 alloc::alloc::exchange_malloc                                      [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:192]
# 7 core::sync::atomic::AtomicUsize::new                               [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\sync\atomic.rs:1158]
# 8 mio::sys::windows::from_raw_arc::FromRawArc<>::new<>               [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\sys\windows\from_raw_arc.rs:41]
# 9 mio::sys::windows::udp::UdpSocket::new                             [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\sys\windows\udp.rs:61]
#10 KERNELBASE.dll!WaitForSingleObjectEx                              +0xa1     (0x00007ff94af89252 <KERNELBASE.dll+0x39252>)
#11 core::ptr::swap_nonoverlapping_bytes                               [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\ptr.rs:426]

Error #10: LEAK 352 direct bytes 0x0000028d9ae92700-0x0000028d9ae92860 + 72144 indirect bytes
# 0 replace_RtlAllocateHeap                                                    [d:\drmemory_package\common\alloc_replace.c:3770]
# 1 ntdll.dll!RtlPcToFileHeader                                               +0x1e     (0x00007ff94e710f6f <ntdll.dll+0x10f6f>)
# 2 ntdll.dll!LdrAddRefDll                                                    +0x4b     (0x00007ff94e75913c <ntdll.dll+0x5913c>)
# 3 core::cell::UnsafeCell<>::new<>                                            [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\cell.rs:1471]
# 4 std::alloc::__default_lib_allocator::__rdl_alloc                           [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\alloc.rs:243]
# 5 alloc::alloc::alloc                                                        [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:82]
# 6 alloc::alloc::exchange_malloc                                              [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:192]
# 7 core::sync::atomic::AtomicUsize::new                                       [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\sync\atomic.rs:1158]
# 8 mio::sys::windows::from_raw_arc::FromRawArc<>::new<>                       [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\sys\windows\from_raw_arc.rs:41]
# 9 mio::sys::windows::udp::UdpSocket::new                                     [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\sys\windows\udp.rs:61]
#10 mio::net::udp::UdpSocket::from_socket                                      [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\net\udp.rs:139]
#11 core::ops::function::FnOnce::call_once<> std::net::udp::UdpSocket,(std::sys_common::net::UdpSocket)> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\ops\function.rs:238]

Error #11: LEAK 64 direct bytes 0x0000028d9aeea660-0x0000028d9aeea6a0 + 0 indirect bytes
# 0 replace_RtlAllocateHeap                                          [d:\drmemory_package\common\alloc_replace.c:3770]
# 1 core::convert::{{impl}}::into<>                                  [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\convert.rs:455]
# 2 mio::poll::ReadinessState::new                                   [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\poll.rs:2580]
# 3 trust_dns_proto::rr::domain::name::{{impl}}::clone               [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\trust-dns-proto-0.7.1\src\rr\domain\name.rs:31]
# 4 core::sync::atomic::AtomicUsize::new                             [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\sync\atomic.rs:1158]
# 5 mio::poll::AtomicState::new                                      [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\poll.rs:2551]
# 6 core::sync::atomic::AtomicUsize::new                             [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\sync\atomic.rs:1158]
# 7 std::alloc::__default_lib_allocator::__rdl_alloc                 [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\alloc.rs:243]
# 8 mio::poll::ReadinessNode::marker                                 [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\poll.rs:2493]
# 9 alloc::alloc::alloc                                              [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:82]
#10 alloc::alloc::exchange_malloc                                    [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:192]
#11 mio::poll::ReadinessQueue::new                                   [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\poll.rs:2096]

Error #12: LEAK 16 direct bytes 0x0000028d9bb79fb0-0x0000028d9bb79fc0 + 0 indirect bytes
# 0 replace_RtlAllocateHeap                                          [d:\drmemory_package\common\alloc_replace.c:3770]
# 1 core::ptr::NonNull<>::new<>                                      [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\ptr.rs:2905]
# 2 alloc::alloc::{{impl}}::alloc                                    [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:158]
# 3 core::convert::{{impl}}::into<>                                  [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\convert.rs:455]
# 4 alloc::raw_vec::RawVec<>::allocate_in<>                          [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\raw_vec.rs:115]
# 5 trust_dns_proto::rr::domain::name::{{impl}}::clone               [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\trust-dns-proto-0.7.1\src\rr\domain\name.rs:31]
# 6 std::alloc::__default_lib_allocator::__rdl_alloc                 [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\alloc.rs:243]
# 7 alloc::alloc::alloc                                              [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:82]
# 8 alloc::alloc::exchange_malloc                                    [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:192]
# 9 alloc::raw_vec::RawVec<>::with_capacity<>                        [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\raw_vec.rs:150]
#10 std::sync::mutex::Mutex<>::new<>                                 [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libstd\sync\mutex.rs:180]
#11 alloc::vec::Vec<>::with_capacity<>                               [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\vec.rs:368]

Error #13: LEAK 6144 direct bytes 0x0000028d9bcc4bf0-0x0000028d9bcc63f0 + 65536 indirect bytes
# 0 replace_RtlAllocateHeap                                                    [d:\drmemory_package\common\alloc_replace.c:3770]
# 1 alloc::slice::{{impl}}::to_vec<>                                           [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\slice.rs:387]
# 2 tokio_timer::clock::clock::with_default::{{closure}}::{{impl}}::drop       [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-timer-0.2.10\src\clock\clock.rs:133]
# 3 alloc::vec::{{impl}}::clone<>                                              [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\vec.rs:1615]
# 4 core::ptr::real_drop_in_place<>                                            [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\ptr.rs:204]
# 5 trust_dns_proto::rr::domain::name::{{impl}}::clone                         [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\trust-dns-proto-0.7.1\src\rr\domain\name.rs:31]
# 6 tokio_timer::clock::clock::with_default::{{closure}}<>                     [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-timer-0.2.10\src\clock\clock.rs:142]
# 7 std::alloc::__default_lib_allocator::__rdl_alloc                           [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\alloc.rs:243]
# 8 core::alloc::Layout::from_size_align_unchecked                             [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\alloc.rs:113]
# 9 alloc::alloc::alloc                                                        [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:82]
#10 alloc::alloc::{{impl}}::alloc                                              [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:158]
#11 alloc::raw_vec::RawVec<>::allocate_in<>                                    [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\raw_vec.rs:106]

Error #14: POSSIBLE LEAK 6144 direct bytes 0x0000028d9e9d9b50-0x0000028d9e9db350 + 0 indirect bytes
# 0 replace_RtlAllocateHeap                                                    [d:\drmemory_package\common\alloc_replace.c:3770]
# 1 alloc::slice::{{impl}}::to_vec<>                                           [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\slice.rs:387]
# 2 tokio_timer::clock::clock::with_default::{{closure}}::{{impl}}::drop       [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-timer-0.2.10\src\clock\clock.rs:133]
# 3 alloc::vec::{{impl}}::clone<>                                              [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\vec.rs:1615]
# 4 core::ptr::real_drop_in_place<>                                            [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\ptr.rs:204]
# 5 trust_dns_proto::rr::domain::name::{{impl}}::clone                         [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\trust-dns-proto-0.7.1\src\rr\domain\name.rs:31]
# 6 tokio_timer::clock::clock::with_default::{{closure}}<>                     [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-timer-0.2.10\src\clock\clock.rs:142]
# 7 std::alloc::__default_lib_allocator::__rdl_alloc                           [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\alloc.rs:243]
# 8 core::alloc::Layout::from_size_align_unchecked                             [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\alloc.rs:113]
# 9 alloc::alloc::alloc                                                        [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:82]
#10 alloc::alloc::{{impl}}::alloc                                              [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:158]
#11 alloc::raw_vec::RawVec<>::allocate_in<>                                    [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\raw_vec.rs:106]

Error #15: HANDLE LEAK: KERNEL handle 0x00000000000000f0 and 1023 similar handle(s) were opened but not closed:
# 0 system call NtCreateIoCompletion                
# 1 KERNELBASE.dll!CreateIoCompletionPort                         +0x87     (0x00007ff94afba268 <KERNELBASE.dll+0x6a268>)
# 2 miow::iocp::CompletionPort::new                                [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\miow-0.2.1\src\iocp.rs:39]
# 3 core::sync::atomic::AtomicUsize::fetch_add                     [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\sync\atomic.rs:1487]
# 4 mio::sys::windows::selector::Selector::new                     [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\sys\windows\selector.rs:58]
# 5 mio::poll::Poll::new                                           [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\poll.rs:655]
# 6 std::io::buffered::{{impl}}::write<>                           [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\io\buffered.rs:587]
# 7 std::io::Write::write_all<>                                    [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\io\mod.rs:1068]
# 8 alloc::alloc::dealloc                                          [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:100]
# 9 std::io::stdio::{{impl}}::write                                [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\io\stdio.rs:470]
#10 std::io::Write::write_fmt::{{impl}}::write_str<>               [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\io\mod.rs:1128]
#11 core::fmt::Formatter::pad_integral                             [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libcore\fmt\mod.rs:0]
#12 core::mem::drop<>                                              [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\mem.rs:774]
#13 tokio_reactor::Reactor::new                                    [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-reactor-0.1.8\src\lib.rs:237]
#14 core::fmt::num::{{impl}}::fmt                                  [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libcore\fmt\num.rs:256]
#15 core::fmt::write                                               [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libcore\fmt\mod.rs:1049]
#16 std::io::buffered::{{impl}}::write<>                           [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\io\buffered.rs:587]
#17 std::io::stdio::{{impl}}::write                                [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\io\stdio.rs:470]
#18 std::net::ip::{{impl}}::fmt                                    [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\net\ip.rs:695]
#19 std::io::Write::write_all<>                                    [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\io\mod.rs:1068]
Note: @0:01:49.779 in thread 4268

===========================================================================
FINAL SUMMARY:

DUPLICATE ERROR COUNTS:
	Error #   1:    956
	Error #   2:    288
	Error #   3:    176
	Error #   4:      8
	Error #   5:      9
	Error #   6:     31
	Error #   7:     32
	Error #   9:      2
	Error #  11:      9
	Error #  12:      5
	Error #  13:      3
	Error #  14:      2
	Error #  15:   1024

SUPPRESSIONS USED:

ERRORS FOUND:
      0 unique,     0 total unaddressable access(es)
      0 unique,     0 total invalid heap argument(s)
      0 unique,     0 total GDI usage error(s)
      1 unique,  1024 total handle leak(s)
      0 unique,     0 total warning(s)
     10 unique,  1510 total, 73639264 byte(s) of leak(s)
      4 unique,    13 total, 669136 byte(s) of possible leak(s)
ERRORS IGNORED:
      4 potential error(s) (suspected false positives)
         (details: C:\Users\IEUser\AppData\Roaming\Dr. Memory\DrMemory-mio-mao.exe.6352.000\potential_errors.txt)
      1 potential leak(s) (suspected false positives)
         (details: C:\Users\IEUser\AppData\Roaming\Dr. Memory\DrMemory-mio-mao.exe.6352.000\potential_errors.txt)
     20 unique,    34 total,  49225 byte(s) of still-reachable allocation(s)
         (re-run with "-show_reachable" for details)
Details: C:\Users\IEUser\AppData\Roaming\Dr. Memory\DrMemory-mio-mao.exe.6352.000\results.txt
Originally created by @oherrala on GitHub (Feb 21, 2019). Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/692 **Describe the bug** Using Trust-DNS client to do a DNS queries in Windows leaks memory causing long running processes to bloat their heap. **To Reproduce** The following code can be used to cause easily observable memory leak in Windows (Windows 10, 10.0.17134 Build 17134). Running it shows memory usage of 72 MB on my test system. Tested with both `trust-dns` versions `0.15.1` and `0.16.0-alpha.2`. Dr. Memory leak detector output below. Replace the IP address with proper DNS server in sample code to get it running. ```toml [package] name = "mio-mao" version = "0.1.0" authors = ["Ossi Herrala <oherrala@iki.fi>"] edition = "2018" [dependencies] trust-dns = "*" ``` ```rust use std::io; use std::net::{SocketAddr, Ipv4Addr}; use std::thread::sleep_ms; use std::str::FromStr; use trust_dns::client::{Client, SyncClient}; use trust_dns::rr::{DNSClass, Name, RecordType}; use trust_dns::udp::UdpClientConnection; fn main() -> io::Result<()> { let ip = Ipv4Addr::new(192,168,1,1); let port = 53; let conn = UdpClientConnection::new(SocketAddr::from((ip, port)))?; let client = SyncClient::new(conn); let name = Name::from_str("example.com")?; for _ in 0..=1024 { match client.query(&name, DNSClass::IN, RecordType::A) { Ok(resp) => println!("DNS response: {:?}", resp), Err(err) => println!("DNS query failed: {}", err), }; } sleep_ms(100_000); Ok(()) } ``` **Expected behavior** Allocated memory should be freed after it's no longer needed. **System:** - OS: Windows - Architecture: amd64 - Version: 10 - rustc version: 1.32.0 **Version:** Crate: `trust-dns` Version: `0.15.1` and `0.16.0-alpha.2` **Additional context** A full [Dr. Memory](https://drmemory.org/) memory leak output: ``` Dr. Memory version 1.11.0 build 2 built on Aug 29 2016 02:41:18 Dr. Memory results for pid 6352: "mio-mao.exe" Application cmdline: "C:\Users\IEUser\AppData\Local\Temp\cargo\debug\mio-mao.exe" Recorded 115 suppression(s) from default C:\Program Files (x86)\Dr. Memory\bin64\suppress-default.txt Error #1: LEAK 352 direct bytes 0x0000028d9a8f0870-0x0000028d9a8f09d0 + 143824 indirect bytes # 0 replace_RtlAllocateHeap [d:\drmemory_package\common\alloc_replace.c:3770] # 1 core::mem::swap<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\mem.rs:621] # 2 core::option::{{impl}}::next<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\option.rs:1101] # 3 core::cell::UnsafeCell<>::new<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\cell.rs:1471] # 4 std::alloc::__default_lib_allocator::__rdl_alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\alloc.rs:243] # 5 alloc::alloc::alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:82] # 6 alloc::alloc::exchange_malloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:192] # 7 core::sync::atomic::AtomicUsize::new [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\sync\atomic.rs:1158] # 8 mio::sys::windows::from_raw_arc::FromRawArc<>::new<> [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\sys\windows\from_raw_arc.rs:41] # 9 mio::sys::windows::udp::UdpSocket::new [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\sys\windows\udp.rs:61] #10 KERNELBASE.dll!WaitForSingleObjectEx +0xa1 (0x00007ff94af89252 <KERNELBASE.dll+0x39252>) #11 core::ptr::swap_nonoverlapping_bytes [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\ptr.rs:426] Error #2: LEAK 88 direct bytes 0x0000028d9a8f24a0-0x0000028d9a8f24f8 + 72040 indirect bytes # 0 replace_RtlAllocateHeap [d:\drmemory_package\common\alloc_replace.c:3770] # 1 std::alloc::__default_lib_allocator::__rdl_alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\alloc.rs:243] # 2 alloc::alloc::alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:82] # 3 std::alloc::__default_lib_allocator::__rdl_alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\alloc.rs:243] # 4 alloc::alloc::alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:82] # 5 alloc::alloc::exchange_malloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:192] # 6 std::sync::mutex::Mutex<>::new<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libstd\sync\mutex.rs:185] # 7 alloc::sync::Arc<>::new<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\sync.rs:298] # 8 mio::sys::windows::awakener::Awakener::new [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\sys\windows\awakener.rs:20] # 9 core::sync::atomic::AtomicPtr<>::new<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\sync\atomic.rs:775] #10 core::result::{{impl}}::into_result<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\result.rs:1265] #11 mio::poll::ReadinessQueue::new [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\poll.rs:2103] Error #3: LEAK 64 direct bytes 0x0000028d9a8f9270-0x0000028d9a8f92b0 + 72128 indirect bytes # 0 replace_RtlAllocateHeap [d:\drmemory_package\common\alloc_replace.c:3770] # 1 core::convert::{{impl}}::into<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\convert.rs:455] # 2 mio::poll::ReadinessState::new [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\poll.rs:2580] # 3 trust_dns_proto::rr::domain::name::{{impl}}::clone [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\trust-dns-proto-0.7.1\src\rr\domain\name.rs:31] # 4 core::sync::atomic::AtomicUsize::new [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\sync\atomic.rs:1158] # 5 mio::poll::AtomicState::new [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\poll.rs:2551] # 6 core::sync::atomic::AtomicUsize::new [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\sync\atomic.rs:1158] # 7 std::alloc::__default_lib_allocator::__rdl_alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\alloc.rs:243] # 8 mio::poll::ReadinessNode::marker [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\poll.rs:2493] # 9 alloc::alloc::alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:82] #10 alloc::alloc::exchange_malloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:192] #11 mio::poll::ReadinessQueue::new [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\poll.rs:2097] Error #4: POSSIBLE LEAK 88 direct bytes 0x0000028d9a9238c0-0x0000028d9a923918 + 72040 indirect bytes # 0 replace_RtlAllocateHeap [d:\drmemory_package\common\alloc_replace.c:3770] # 1 std::alloc::__default_lib_allocator::__rdl_alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\alloc.rs:243] # 2 alloc::alloc::alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:82] # 3 std::alloc::__default_lib_allocator::__rdl_alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\alloc.rs:243] # 4 alloc::alloc::alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:82] # 5 alloc::alloc::exchange_malloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:192] # 6 std::sync::mutex::Mutex<>::new<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libstd\sync\mutex.rs:185] # 7 alloc::sync::Arc<>::new<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\sync.rs:298] # 8 mio::sys::windows::awakener::Awakener::new [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\sys\windows\awakener.rs:20] # 9 core::sync::atomic::AtomicPtr<>::new<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\sync\atomic.rs:775] #10 core::result::{{impl}}::into_result<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\result.rs:1265] #11 mio::poll::ReadinessQueue::new [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\poll.rs:2103] Error #5: LEAK 16 direct bytes 0x0000028d9a92f2b0-0x0000028d9a92f2c0 + 0 indirect bytes # 0 replace_RtlAllocateHeap [d:\drmemory_package\common\alloc_replace.c:3770] # 1 alloc::vec::{{impl}}::clone<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\vec.rs:1615] # 2 std::alloc::__default_lib_allocator::__rdl_alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\alloc.rs:243] # 3 alloc::alloc::alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:82] # 4 alloc::alloc::exchange_malloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:192] # 5 trust_dns_proto::rr::domain::name::{{impl}}::clone [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\trust-dns-proto-0.7.1\src\rr\domain\name.rs:31] # 6 core::sync::atomic::AtomicUsize::new [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\sync\atomic.rs:1158] # 7 std::sync::mutex::Mutex<>::new<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libstd\sync\mutex.rs:180] # 8 core::sync::atomic::AtomicUsize::new [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\sync\atomic.rs:1158] # 9 alloc::alloc::alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:82] #10 mio::sys::windows::awakener::Awakener::new [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\sys\windows\awakener.rs:20] #11 mio::poll::ReadinessQueue::new [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\poll.rs:2104] Error #6: LEAK 352 direct bytes 0x0000028d9a961670-0x0000028d9a9617d0 + 143760 indirect bytes # 0 replace_RtlAllocateHeap [d:\drmemory_package\common\alloc_replace.c:3770] # 1 core::cell::UnsafeCell<>::new<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\cell.rs:1471] # 2 std::alloc::__default_lib_allocator::__rdl_alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\alloc.rs:243] # 3 alloc::alloc::alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:82] # 4 alloc::alloc::exchange_malloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:192] # 5 core::sync::atomic::AtomicUsize::new [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\sync\atomic.rs:1158] # 6 mio::sys::windows::from_raw_arc::FromRawArc<>::new<> [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\sys\windows\from_raw_arc.rs:41] # 7 mio::sys::windows::udp::UdpSocket::new [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\sys\windows\udp.rs:61] # 8 KERNELBASE.dll!WaitForSingleObjectEx +0xa1 (0x00007ff94af89252 <KERNELBASE.dll+0x39252>) # 9 core::ptr::swap_nonoverlapping_bytes [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\ptr.rs:426] #10 core::ptr::swap_nonoverlapping<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\ptr.rs:362] #11 core::ptr::swap_nonoverlapping_bytes [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\ptr.rs:426] Error #7: LEAK 352 direct bytes 0x0000028d9a98b410-0x0000028d9a98b570 + 72208 indirect bytes # 0 replace_RtlAllocateHeap [d:\drmemory_package\common\alloc_replace.c:3770] # 1 core::mem::swap<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\mem.rs:621] # 2 core::option::{{impl}}::next<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\option.rs:1101] # 3 core::cell::UnsafeCell<>::new<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\cell.rs:1471] # 4 std::alloc::__default_lib_allocator::__rdl_alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\alloc.rs:243] # 5 alloc::alloc::alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:82] # 6 alloc::alloc::exchange_malloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:192] # 7 core::sync::atomic::AtomicUsize::new [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\sync\atomic.rs:1158] # 8 mio::sys::windows::from_raw_arc::FromRawArc<>::new<> [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\sys\windows\from_raw_arc.rs:41] # 9 mio::sys::windows::udp::UdpSocket::new [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\sys\windows\udp.rs:61] #10 mio::net::udp::UdpSocket::from_socket [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\net\udp.rs:139] #11 core::ops::function::FnOnce::call_once<> std::net::udp::UdpSocket,(std::sys_common::net::UdpSocket)> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\ops\function.rs:238] Error #8: POSSIBLE LEAK 352 direct bytes 0x0000028d9ac10020-0x0000028d9ac10180 + 71784 indirect bytes # 0 replace_RtlAllocateHeap [d:\drmemory_package\common\alloc_replace.c:3770] # 1 core::mem::swap<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\mem.rs:621] # 2 core::option::{{impl}}::next<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\option.rs:1101] # 3 core::cell::UnsafeCell<>::new<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\cell.rs:1471] # 4 std::alloc::__default_lib_allocator::__rdl_alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\alloc.rs:243] # 5 alloc::alloc::alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:82] # 6 alloc::alloc::exchange_malloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:192] # 7 core::sync::atomic::AtomicUsize::new [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\sync\atomic.rs:1158] # 8 mio::sys::windows::from_raw_arc::FromRawArc<>::new<> [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\sys\windows\from_raw_arc.rs:41] # 9 mio::sys::windows::udp::UdpSocket::new [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\sys\windows\udp.rs:61] #10 mio::net::udp::UdpSocket::from_socket [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\net\udp.rs:139] #11 core::ops::function::FnOnce::call_once<> std::net::udp::UdpSocket,(std::sys_common::net::UdpSocket)> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\ops\function.rs:238] Error #9: POSSIBLE LEAK 352 direct bytes 0x0000028d9acb0bd0-0x0000028d9acb0d30 + 72144 indirect bytes # 0 replace_RtlAllocateHeap [d:\drmemory_package\common\alloc_replace.c:3770] # 1 core::mem::swap<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\mem.rs:621] # 2 core::option::{{impl}}::next<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\option.rs:1101] # 3 core::cell::UnsafeCell<>::new<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\cell.rs:1471] # 4 std::alloc::__default_lib_allocator::__rdl_alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\alloc.rs:243] # 5 alloc::alloc::alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:82] # 6 alloc::alloc::exchange_malloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:192] # 7 core::sync::atomic::AtomicUsize::new [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\sync\atomic.rs:1158] # 8 mio::sys::windows::from_raw_arc::FromRawArc<>::new<> [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\sys\windows\from_raw_arc.rs:41] # 9 mio::sys::windows::udp::UdpSocket::new [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\sys\windows\udp.rs:61] #10 KERNELBASE.dll!WaitForSingleObjectEx +0xa1 (0x00007ff94af89252 <KERNELBASE.dll+0x39252>) #11 core::ptr::swap_nonoverlapping_bytes [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\ptr.rs:426] Error #10: LEAK 352 direct bytes 0x0000028d9ae92700-0x0000028d9ae92860 + 72144 indirect bytes # 0 replace_RtlAllocateHeap [d:\drmemory_package\common\alloc_replace.c:3770] # 1 ntdll.dll!RtlPcToFileHeader +0x1e (0x00007ff94e710f6f <ntdll.dll+0x10f6f>) # 2 ntdll.dll!LdrAddRefDll +0x4b (0x00007ff94e75913c <ntdll.dll+0x5913c>) # 3 core::cell::UnsafeCell<>::new<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\cell.rs:1471] # 4 std::alloc::__default_lib_allocator::__rdl_alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\alloc.rs:243] # 5 alloc::alloc::alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:82] # 6 alloc::alloc::exchange_malloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:192] # 7 core::sync::atomic::AtomicUsize::new [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\sync\atomic.rs:1158] # 8 mio::sys::windows::from_raw_arc::FromRawArc<>::new<> [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\sys\windows\from_raw_arc.rs:41] # 9 mio::sys::windows::udp::UdpSocket::new [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\sys\windows\udp.rs:61] #10 mio::net::udp::UdpSocket::from_socket [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\net\udp.rs:139] #11 core::ops::function::FnOnce::call_once<> std::net::udp::UdpSocket,(std::sys_common::net::UdpSocket)> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\ops\function.rs:238] Error #11: LEAK 64 direct bytes 0x0000028d9aeea660-0x0000028d9aeea6a0 + 0 indirect bytes # 0 replace_RtlAllocateHeap [d:\drmemory_package\common\alloc_replace.c:3770] # 1 core::convert::{{impl}}::into<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\convert.rs:455] # 2 mio::poll::ReadinessState::new [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\poll.rs:2580] # 3 trust_dns_proto::rr::domain::name::{{impl}}::clone [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\trust-dns-proto-0.7.1\src\rr\domain\name.rs:31] # 4 core::sync::atomic::AtomicUsize::new [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\sync\atomic.rs:1158] # 5 mio::poll::AtomicState::new [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\poll.rs:2551] # 6 core::sync::atomic::AtomicUsize::new [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\sync\atomic.rs:1158] # 7 std::alloc::__default_lib_allocator::__rdl_alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\alloc.rs:243] # 8 mio::poll::ReadinessNode::marker [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\poll.rs:2493] # 9 alloc::alloc::alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:82] #10 alloc::alloc::exchange_malloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:192] #11 mio::poll::ReadinessQueue::new [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\poll.rs:2096] Error #12: LEAK 16 direct bytes 0x0000028d9bb79fb0-0x0000028d9bb79fc0 + 0 indirect bytes # 0 replace_RtlAllocateHeap [d:\drmemory_package\common\alloc_replace.c:3770] # 1 core::ptr::NonNull<>::new<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\ptr.rs:2905] # 2 alloc::alloc::{{impl}}::alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:158] # 3 core::convert::{{impl}}::into<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\convert.rs:455] # 4 alloc::raw_vec::RawVec<>::allocate_in<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\raw_vec.rs:115] # 5 trust_dns_proto::rr::domain::name::{{impl}}::clone [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\trust-dns-proto-0.7.1\src\rr\domain\name.rs:31] # 6 std::alloc::__default_lib_allocator::__rdl_alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\alloc.rs:243] # 7 alloc::alloc::alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:82] # 8 alloc::alloc::exchange_malloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:192] # 9 alloc::raw_vec::RawVec<>::with_capacity<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\raw_vec.rs:150] #10 std::sync::mutex::Mutex<>::new<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libstd\sync\mutex.rs:180] #11 alloc::vec::Vec<>::with_capacity<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\vec.rs:368] Error #13: LEAK 6144 direct bytes 0x0000028d9bcc4bf0-0x0000028d9bcc63f0 + 65536 indirect bytes # 0 replace_RtlAllocateHeap [d:\drmemory_package\common\alloc_replace.c:3770] # 1 alloc::slice::{{impl}}::to_vec<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\slice.rs:387] # 2 tokio_timer::clock::clock::with_default::{{closure}}::{{impl}}::drop [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-timer-0.2.10\src\clock\clock.rs:133] # 3 alloc::vec::{{impl}}::clone<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\vec.rs:1615] # 4 core::ptr::real_drop_in_place<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\ptr.rs:204] # 5 trust_dns_proto::rr::domain::name::{{impl}}::clone [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\trust-dns-proto-0.7.1\src\rr\domain\name.rs:31] # 6 tokio_timer::clock::clock::with_default::{{closure}}<> [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-timer-0.2.10\src\clock\clock.rs:142] # 7 std::alloc::__default_lib_allocator::__rdl_alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\alloc.rs:243] # 8 core::alloc::Layout::from_size_align_unchecked [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\alloc.rs:113] # 9 alloc::alloc::alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:82] #10 alloc::alloc::{{impl}}::alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:158] #11 alloc::raw_vec::RawVec<>::allocate_in<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\raw_vec.rs:106] Error #14: POSSIBLE LEAK 6144 direct bytes 0x0000028d9e9d9b50-0x0000028d9e9db350 + 0 indirect bytes # 0 replace_RtlAllocateHeap [d:\drmemory_package\common\alloc_replace.c:3770] # 1 alloc::slice::{{impl}}::to_vec<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\slice.rs:387] # 2 tokio_timer::clock::clock::with_default::{{closure}}::{{impl}}::drop [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-timer-0.2.10\src\clock\clock.rs:133] # 3 alloc::vec::{{impl}}::clone<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\vec.rs:1615] # 4 core::ptr::real_drop_in_place<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\ptr.rs:204] # 5 trust_dns_proto::rr::domain::name::{{impl}}::clone [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\trust-dns-proto-0.7.1\src\rr\domain\name.rs:31] # 6 tokio_timer::clock::clock::with_default::{{closure}}<> [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-timer-0.2.10\src\clock\clock.rs:142] # 7 std::alloc::__default_lib_allocator::__rdl_alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\alloc.rs:243] # 8 core::alloc::Layout::from_size_align_unchecked [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\alloc.rs:113] # 9 alloc::alloc::alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:82] #10 alloc::alloc::{{impl}}::alloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:158] #11 alloc::raw_vec::RawVec<>::allocate_in<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\raw_vec.rs:106] Error #15: HANDLE LEAK: KERNEL handle 0x00000000000000f0 and 1023 similar handle(s) were opened but not closed: # 0 system call NtCreateIoCompletion # 1 KERNELBASE.dll!CreateIoCompletionPort +0x87 (0x00007ff94afba268 <KERNELBASE.dll+0x6a268>) # 2 miow::iocp::CompletionPort::new [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\miow-0.2.1\src\iocp.rs:39] # 3 core::sync::atomic::AtomicUsize::fetch_add [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\sync\atomic.rs:1487] # 4 mio::sys::windows::selector::Selector::new [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\sys\windows\selector.rs:58] # 5 mio::poll::Poll::new [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\mio-0.6.16\src\poll.rs:655] # 6 std::io::buffered::{{impl}}::write<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\io\buffered.rs:587] # 7 std::io::Write::write_all<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\io\mod.rs:1068] # 8 alloc::alloc::dealloc [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\liballoc\alloc.rs:100] # 9 std::io::stdio::{{impl}}::write [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\io\stdio.rs:470] #10 std::io::Write::write_fmt::{{impl}}::write_str<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\io\mod.rs:1128] #11 core::fmt::Formatter::pad_integral [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libcore\fmt\mod.rs:0] #12 core::mem::drop<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\src\libcore\mem.rs:774] #13 tokio_reactor::Reactor::new [C:\Users\IEUser\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-reactor-0.1.8\src\lib.rs:237] #14 core::fmt::num::{{impl}}::fmt [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libcore\fmt\num.rs:256] #15 core::fmt::write [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libcore\fmt\mod.rs:1049] #16 std::io::buffered::{{impl}}::write<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\io\buffered.rs:587] #17 std::io::stdio::{{impl}}::write [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\io\stdio.rs:470] #18 std::net::ip::{{impl}}::fmt [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\net\ip.rs:695] #19 std::io::Write::write_all<> [/rustc/9fda7c2237db910e41d6a712e9a2139b352e558b\/src\libstd\io\mod.rs:1068] Note: @0:01:49.779 in thread 4268 =========================================================================== FINAL SUMMARY: DUPLICATE ERROR COUNTS: Error # 1: 956 Error # 2: 288 Error # 3: 176 Error # 4: 8 Error # 5: 9 Error # 6: 31 Error # 7: 32 Error # 9: 2 Error # 11: 9 Error # 12: 5 Error # 13: 3 Error # 14: 2 Error # 15: 1024 SUPPRESSIONS USED: ERRORS FOUND: 0 unique, 0 total unaddressable access(es) 0 unique, 0 total invalid heap argument(s) 0 unique, 0 total GDI usage error(s) 1 unique, 1024 total handle leak(s) 0 unique, 0 total warning(s) 10 unique, 1510 total, 73639264 byte(s) of leak(s) 4 unique, 13 total, 669136 byte(s) of possible leak(s) ERRORS IGNORED: 4 potential error(s) (suspected false positives) (details: C:\Users\IEUser\AppData\Roaming\Dr. Memory\DrMemory-mio-mao.exe.6352.000\potential_errors.txt) 1 potential leak(s) (suspected false positives) (details: C:\Users\IEUser\AppData\Roaming\Dr. Memory\DrMemory-mio-mao.exe.6352.000\potential_errors.txt) 20 unique, 34 total, 49225 byte(s) of still-reachable allocation(s) (re-run with "-show_reachable" for details) Details: C:\Users\IEUser\AppData\Roaming\Dr. Memory\DrMemory-mio-mao.exe.6352.000\results.txt ```
Author
Owner

@bluejekyll commented on GitHub (Feb 21, 2019):

Do you know if this only occurs on Windows? Or is that the only environment you've validated this on?

Also, could you post your Cargo.lock file?

<!-- gh-comment-id:466008187 --> @bluejekyll commented on GitHub (Feb 21, 2019): Do you know if this only occurs on Windows? Or is that the only environment you've validated this on? Also, could you post your Cargo.lock file?
Author
Owner

@oherrala commented on GitHub (Feb 21, 2019):

Do you know if this only occurs on Windows? Or is that the only environment you've validated this on?

This occurs on Windows, but not on macOS. Also XCode's Instruments didn't find memory leaks. Running on Linux shows RSS of about 5MB, so doesn't look like leaking.

Also, could you post your Cargo.lock file?

Cargo.lock

<!-- gh-comment-id:466012008 --> @oherrala commented on GitHub (Feb 21, 2019): > Do you know if this only occurs on Windows? Or is that the only environment you've validated this on? This occurs on Windows, but not on macOS. Also XCode's Instruments didn't find memory leaks. Running on Linux shows RSS of about 5MB, so doesn't look like leaking. > Also, could you post your Cargo.lock file? [Cargo.lock](https://github.com/bluejekyll/trust-dns/files/2889578/Cargo.lock.txt)
Author
Owner

@oherrala commented on GitHub (Feb 25, 2019):

Here's a debug trace of the following code:

fn main() -> io::Result<()> {
    env_logger::init();

    let ip = Ipv4Addr::new(192,168,88,1);
    let port = 53;
    let conn = UdpClientConnection::new(SocketAddr::from((ip, port)))?;
    let client = SyncClient::new(conn);    
    let name = Name::from_str("example.com")?;

    for _ in 0..1 {
        match client.query(&name, DNSClass::IN, RecordType::A) {
            Ok(resp) => println!("DNS response: {:?}", resp),
            Err(err) => println!("DNS query failed: {}", err),
        };
    }

    sleep_ms(1_000);
    Ok(())
}
[2019-02-25T11:52:31Z TRACE mio::poll] registering with poller
[2019-02-25T11:52:31Z DEBUG trust_dns_proto::xfer::dns_handle] querying: example.com A
[2019-02-25T11:52:31Z DEBUG trust_dns_proto::xfer] enqueueing message: [Query { name: Name { is_fqdn: false, labels: [example, com] }, query_type: A, query_class: IN }]
[2019-02-25T11:52:31Z DEBUG trust_dns_proto::xfer::dns_exchange] connection established: UDP(192.168.88.1:53)
[2019-02-25T11:52:31Z INFO  trust_dns_proto::xfer::dns_exchange] sending message via: UDP(192.168.88.1:53)
[2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] select; timeout=Some(0ns)
[2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] polling IOCP
[2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] returning
[2019-02-25T11:52:31Z TRACE tokio_reactor] event Readable Token(4194303)
[2019-02-25T11:52:31Z TRACE tokio_reactor] loop process - 1 events, 0.000s
[2019-02-25T11:52:31Z DEBUG trust_dns_proto::udp::udp_stream] created socket: UdpSocket
[2019-02-25T11:52:31Z TRACE mio::poll] registering with poller
[2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] register Token(0) Readable | Writable
[2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] set readiness to (empty)
[2019-02-25T11:52:31Z TRACE mio::sys::windows::udp] scheduling a read
[2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] set readiness to Writable
[2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] select; timeout=Some(0ns)
[2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] polling IOCP
[2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] returning
[2019-02-25T11:52:31Z TRACE tokio_reactor] event Readable Token(4194303)
[2019-02-25T11:52:31Z TRACE tokio_reactor] event Writable Token(0)
[2019-02-25T11:52:31Z TRACE tokio_reactor] loop process - 2 events, 0.000s
[2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] set readiness to (empty)
[2019-02-25T11:52:31Z TRACE mio::sys::windows::udp] scheduling a send
[2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] select; timeout=Some(0ns)
[2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] polling IOCP
[2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] select; -> got overlapped
[2019-02-25T11:52:31Z TRACE mio::sys::windows::udp] finished a send 40
[2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] set readiness to Writable
[2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] returning
[2019-02-25T11:52:31Z TRACE tokio_reactor] event Readable Token(4194303)
[2019-02-25T11:52:31Z TRACE tokio_reactor] event Writable Token(0)
[2019-02-25T11:52:31Z TRACE tokio_reactor] loop process - 2 events, 0.000s
[2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] select; timeout=Some(0ns)
[2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] polling IOCP
[2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] select; -> got overlapped
[2019-02-25T11:52:31Z TRACE mio::sys::windows::udp] finished a recv 45
[2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] set readiness to Readable | Writable
[2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] returning
[2019-02-25T11:52:31Z TRACE tokio_reactor] event Readable | Writable Token(0)
[2019-02-25T11:52:31Z TRACE tokio_reactor] loop process - 1 events, 0.000s
[2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] set readiness to Writable
[2019-02-25T11:52:31Z TRACE mio::sys::windows::udp] scheduling a read
[2019-02-25T11:52:31Z DEBUG trust_dns_proto::rr::record_data] reading A
[2019-02-25T11:52:31Z DEBUG trust_dns_proto::udp::udp_client_stream] received message id: 48887
[2019-02-25T11:52:31Z TRACE mio::poll] deregistering handle with poller
[2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] deregistering
[2019-02-25T11:52:31Z DEBUG tokio_reactor] dropping I/O source: 0
<!-- gh-comment-id:466985211 --> @oherrala commented on GitHub (Feb 25, 2019): Here's a debug trace of the following code: ```rust fn main() -> io::Result<()> { env_logger::init(); let ip = Ipv4Addr::new(192,168,88,1); let port = 53; let conn = UdpClientConnection::new(SocketAddr::from((ip, port)))?; let client = SyncClient::new(conn); let name = Name::from_str("example.com")?; for _ in 0..1 { match client.query(&name, DNSClass::IN, RecordType::A) { Ok(resp) => println!("DNS response: {:?}", resp), Err(err) => println!("DNS query failed: {}", err), }; } sleep_ms(1_000); Ok(()) } ``` ``` [2019-02-25T11:52:31Z TRACE mio::poll] registering with poller [2019-02-25T11:52:31Z DEBUG trust_dns_proto::xfer::dns_handle] querying: example.com A [2019-02-25T11:52:31Z DEBUG trust_dns_proto::xfer] enqueueing message: [Query { name: Name { is_fqdn: false, labels: [example, com] }, query_type: A, query_class: IN }] [2019-02-25T11:52:31Z DEBUG trust_dns_proto::xfer::dns_exchange] connection established: UDP(192.168.88.1:53) [2019-02-25T11:52:31Z INFO trust_dns_proto::xfer::dns_exchange] sending message via: UDP(192.168.88.1:53) [2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] select; timeout=Some(0ns) [2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] polling IOCP [2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] returning [2019-02-25T11:52:31Z TRACE tokio_reactor] event Readable Token(4194303) [2019-02-25T11:52:31Z TRACE tokio_reactor] loop process - 1 events, 0.000s [2019-02-25T11:52:31Z DEBUG trust_dns_proto::udp::udp_stream] created socket: UdpSocket [2019-02-25T11:52:31Z TRACE mio::poll] registering with poller [2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] register Token(0) Readable | Writable [2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] set readiness to (empty) [2019-02-25T11:52:31Z TRACE mio::sys::windows::udp] scheduling a read [2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] set readiness to Writable [2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] select; timeout=Some(0ns) [2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] polling IOCP [2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] returning [2019-02-25T11:52:31Z TRACE tokio_reactor] event Readable Token(4194303) [2019-02-25T11:52:31Z TRACE tokio_reactor] event Writable Token(0) [2019-02-25T11:52:31Z TRACE tokio_reactor] loop process - 2 events, 0.000s [2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] set readiness to (empty) [2019-02-25T11:52:31Z TRACE mio::sys::windows::udp] scheduling a send [2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] select; timeout=Some(0ns) [2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] polling IOCP [2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] select; -> got overlapped [2019-02-25T11:52:31Z TRACE mio::sys::windows::udp] finished a send 40 [2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] set readiness to Writable [2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] returning [2019-02-25T11:52:31Z TRACE tokio_reactor] event Readable Token(4194303) [2019-02-25T11:52:31Z TRACE tokio_reactor] event Writable Token(0) [2019-02-25T11:52:31Z TRACE tokio_reactor] loop process - 2 events, 0.000s [2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] select; timeout=Some(0ns) [2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] polling IOCP [2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] select; -> got overlapped [2019-02-25T11:52:31Z TRACE mio::sys::windows::udp] finished a recv 45 [2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] set readiness to Readable | Writable [2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] returning [2019-02-25T11:52:31Z TRACE tokio_reactor] event Readable | Writable Token(0) [2019-02-25T11:52:31Z TRACE tokio_reactor] loop process - 1 events, 0.000s [2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] set readiness to Writable [2019-02-25T11:52:31Z TRACE mio::sys::windows::udp] scheduling a read [2019-02-25T11:52:31Z DEBUG trust_dns_proto::rr::record_data] reading A [2019-02-25T11:52:31Z DEBUG trust_dns_proto::udp::udp_client_stream] received message id: 48887 [2019-02-25T11:52:31Z TRACE mio::poll] deregistering handle with poller [2019-02-25T11:52:31Z TRACE mio::sys::windows::selector] deregistering [2019-02-25T11:52:31Z DEBUG tokio_reactor] dropping I/O source: 0 ```
Author
Owner

@oherrala commented on GitHub (Feb 25, 2019):

I probably was able to isolate this issue into mio crate and reported it there: https://github.com/carllerche/mio/issues/919.

<!-- gh-comment-id:466994033 --> @oherrala commented on GitHub (Feb 25, 2019): I probably was able to isolate this issue into `mio` crate and reported it there: https://github.com/carllerche/mio/issues/919.
Author
Owner

@bluejekyll commented on GitHub (Feb 25, 2019):

Thank you for continuing to track this down!

<!-- gh-comment-id:467012307 --> @bluejekyll commented on GitHub (Feb 25, 2019): Thank you for continuing to track this down!
Author
Owner

@oherrala commented on GitHub (Aug 20, 2019):

This might have been fixed in https://github.com/tokio-rs/mio/pull/1034

<!-- gh-comment-id:523006231 --> @oherrala commented on GitHub (Aug 20, 2019): This might have been fixed in https://github.com/tokio-rs/mio/pull/1034
Author
Owner

@bluejekyll commented on GitHub (Aug 20, 2019):

Excellent. I've started the slog of upgrading to the future tokio std::future releases. Not sure if the above change is something we can easily incorporate or not?

<!-- gh-comment-id:523110733 --> @bluejekyll commented on GitHub (Aug 20, 2019): Excellent. I've started the slog of upgrading to the future tokio std::future releases. Not sure if the above change is something we can easily incorporate or not?
Author
Owner

@oherrala commented on GitHub (Oct 16, 2020):

Tokio 0.3 has been released (https://tokio.rs/blog/2020-10-tokio-0-3) and it contains mio 0.7 which has fixed the memory leak in Windows.

We are getting closer to be able to hopefully close this!

<!-- gh-comment-id:709922570 --> @oherrala commented on GitHub (Oct 16, 2020): Tokio 0.3 has been released (https://tokio.rs/blog/2020-10-tokio-0-3) and it contains mio 0.7 which has fixed the memory leak in Windows. We are getting closer to be able to hopefully close this!
Author
Owner

@djc commented on GitHub (Oct 16, 2020):

If there is no other work to be done in trust-dns, how about we close this as a duplicate of #1250 then?

<!-- gh-comment-id:709989989 --> @djc commented on GitHub (Oct 16, 2020): If there is no other work to be done in trust-dns, how about we close this as a duplicate of #1250 then?
Author
Owner

@oherrala commented on GitHub (Jan 7, 2021):

I think this is now fixed in latest trust-dns release (0.20, PRs #1330, #1262).

Thanks everyone involved. Good job!

Closing this now.

<!-- gh-comment-id:756050873 --> @oherrala commented on GitHub (Jan 7, 2021): I think this is now fixed in latest trust-dns release ([0.20](https://github.com/bluejekyll/trust-dns/releases/tag/v0.20.0), PRs #1330, #1262). Thanks everyone involved. Good job! Closing this now.
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#273
No description provided.