Code Monkey home page Code Monkey logo

dhat-rs's People

Contributors

adamchalmers avatar agrover avatar garypen avatar matklad avatar nnethercote avatar rustyyato avatar tomaka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dhat-rs's Issues

Reported totals are slighty different compared to valgrind output

While trying this with a few trivial binaries I noticed the summaries are a bit different from what the valgrind-3.15.0 or valgrind-3.17.0.GIT report. The two valgrind versions agree on the totals, except on reads/writes. This is likely nothing critical and I am asking mostly out of interest, if you'd already know why the numbers are different.

dhat-rs 0.1.1:

dhat: Total:     44,792 bytes in 92 blocks
dhat: At t-gmax: 25,872 bytes in 9 blocks
dhat: At t-end:  9,344 bytes in 5 blocks

valgrind-3.17.0.GIT (on f4d98ff79d5a79102b777ea7e23002d9f7326489):

==79275== Total:     46,769 bytes in 101 blocks
==79275== At t-gmax: 25,957 bytes in 12 blocks
==79275== At t-end:  8,232 bytes in 2 blocks
==79275== Reads:     4,855,431 bytes
==79275== Writes:    921,275 bytes

I am mainly wondering about the difference in Total between dhat-rs and valgrind --tool=dhat --mode=heap. The above binary was a debug build. The optimized builds get the same respective totals.

Unnecessary files in 0.3.2 source

It seems that some build artifacts and logs were present in the local repo that was published to crates.io, and so they ended up in the crate source distribution: https://docs.rs/crate/dhat/0.3.2/source/. This made the crate size go from 31KB in version 0.3.1 to 183KB in version 0.3.2, despite the fact that the only difference between the two is a dependency change.

RFC on changes for 0.3

dhat 0.3 will have several major changes compared to 0.2, including API changes. This issue will serve as a place for discussion on these changes, including suggestions for improvements.

You can try the 0.3.0-pre.1 release by adding this dependency to your Cargo.toml:

dhat = "0.3.0-pre"

The rust docs can be seen here.

Heap profiling basics

With 0.2, a simple heap profiling example looks like this:

use dhat::{Dhat, DhatAlloc};

#[global_allocator]
static ALLOC: DhatAlloc = DhatAlloc;

fn main() {
    let _dhat = Dhat::start_heap_profiling();
    println!("Hello, world!");
}

With 0.3, it looks like this:

#[global_allocator]
static ALLOC: dhat::Alloc = dhat::Alloc;

fn main() {
    let _profiler = dhat::Profiler::new_heap();
    println!("Hello, world!");
}

Explicit qualification is now preferred to use statements. This avoids the extra use line, which helps avoid warnings (or errors) if you are switching between profiling and non-profiling by commenting/uncommenting the #[global_allocator] declaration and/or the let _profiler line. It's also helpful for the newly added assertions, see below. Dhat is removed from type names to help with this, e.g. DhatAlloc is renamed Alloc, because writing dhat::DhatAlloc is silly.

Dhat is renamed Profiler. This name better reflects what it is; Dhat was meaningless. This also works better with the new ProfilerBuilder type, described below. And the new_heap() function name is a more typical name for a constructor.

Ad hoc profiling basics

With 0.2, a simple ad hoc profiling example looks like this:

use dhat::Dhat;

fn main() {
    let _dhat = Dhat::start_ad_hoc_profiling();
    dhat::ad_hoc_event(100);
}

With 0.3, it looks like this:

fn main() {
    let _profiler = dhat::Profiler::new_ad_hoc();
    dhat::ad_hoc_event(100);
}

Stats

In 0.2, the Stats struct was only intended for internal testing purposes and contained an optional HeapStats value, which was an awkward way of handling the heap/ad hoc split. Some of the field names made sense for heap profiling but not for ad hoc profiling. There was a top-level get_stats() function to get stats.

In 0.3 there is a HeapStats struct and an AdHocStats struct. There are HeapStats::get() and AdHocStats::get() functions for getting stats. The field names all make sense. The fields in these structs are all public, which is arguably bad, but changes are unlikely because that would also require changes to DHAT in Valgrind and the DHAT viewer, and the file format shared by all.

ProfilerBuilder

There are now more configurations for a Profiler, so ProfilerBuilder exists to specify these. (You can use Profiler::new_{heap,ad_hoc} for the most basic cases.)

ProfilerBuilder is a pretty standard use of the builder pattern. Some of the methods are argument-free and set a flag internally, e.g. ad_hoc() and testing(). One might argue that they should have arguments, something like:

  • kind(ProfilerKind::AdHoc) instead of ad_hoc()
  • testing(true) instead of testing()

But the alternatives (mode(ProfilerKind::Heap) and testing(false)) would never occur in practice because they are the defaults. So it would be unnecessary generality that hurts conciseness.

There are also a couple of hidden methods that are only useful for testing purposes.

Heap usage testing

0.2 could be used in one way: for profiling.

0.3 adds a new use: heap usage testing. You can write a test for your library crate that executes some code, and then write assertions about how much memory was allocated, such as exactly M allocations occurred, or fewer than N bytes were allocated. (Ad hoc usage testing is also possible, but it's less likely to be used.)

Integration tests must be used, with one test per file. This is because there is global state involved, and multiple tests in the same process would interfere with each other. Testing mode must be turned on via ProfilerBuilder::testing(). If that's done, the following occurs.

  • The saving of data to file on Profiler drop is disabled.
  • The macros dhat::assert!, dhat::assert_eq!, and dhat::assert_ne! become available for use. (They panic immediately if used while not in testing mode.)

An example, which should be put within tests/:

#[global_allocator]
static ALLOC: dhat::Alloc = dhat::Alloc;

#[test]
fn test1() {
    let _profiler = dhat::ProfilerBuilder::new().testing().build();

    let _v1 = vec![1, 2, 3, 4];
    let _v2 = vec![5, 6, 7, 8];

    let stats = dhat::HeapStats::get();
    dhat::assert_eq!(stats.curr_blocks, 2);
    dhat::assert_eq!(stats.curr_bytes, 32);
}

Custom assertions are required because they behave differently to std assertions: on failure, they save data to file before panicking with an error message. The newly established preference for avoiding use statements for dhat identifiers means that these will be explicitly qualified, and are unlikely to be confused with the std equivalents.

Panics

0.3 panics in a number of situations that 0.2 did not.

  • If a second Profiler is created. (Previously it was ignored.)
  • If stats are requested while a Profiler isn't running. (Previously it was ignored.)
  • If heap stats are requested while an ad hoc profiler is running or vice versa. (Previously there was a less clear distinction between heap stats and ad hoc stats.)
  • If a dhat assertion is called while a Profiler isn't running, or if the running Profiler isn't in test mode. (These scenarios didn't exist in 0.2.)

These are scenarios that only occur if the dhat user has done something wrong, and panicking is generally easier—either for dhat itself, or for the user, or both—than trying to handle it gracefully (e.g. ignoring actions, or return an Option).

Backtrace trimming

0.2 would always get full length backtraces. These can be large, e.g. 100+ frames in big programs. Processing these causes a lot of overhead.

0.3 limits the length of backtraces. By default it's 10 "real" frames, but once inline frames get added it's often 20 or more. This is almost always more than enough to work out what's going on. The ProfilerBuilder::trim() method can be used to adjust the length limit, and "unlimited" is a possibility.

It would be better if the length limit was precise, but the getting of the real frames happens when the raw backtrace is obtained, and the inline frame addition happens later when aggregated backtraces are "resolved" using debug info. If the backtraces were resolved upfront the lengths could be precise, but this would greatly increase the amount of resolving that happens, which is very expensive.

There's also an improved mechanism for trimming uninteresting frames at the top and bottom of backtraces. (This is separate to the length limit, and these trimmed frames don't count towards the limit.) This can also be turned off with ProfilerBuilder::trim(), though it's unlikely to be of interest except for dhat testing/development purposes.

Conclusion

I think this is a solid re-design of the APIs, and the heap usage testing is a genuinely useful capability that isn't available in any other way.

I would like to hear feedback about the APIs and the implementation. Reports from people who have tried it out on real-world code are particularly appreciated. Thanks!

Once a certain amount of time has passed (probably 2 weeks) I will make adjustments based on feedback. If there aren't any major issues I will do a 0.3.0 release shortly after that.

Assertion failures and double free when integrating dhat into rust-analyzer

After applying this patch to rust-lang/rust-analyzer@3df4b8c:

diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml
index 039976e4b..66f395518 100644
--- a/crates/rust-analyzer/Cargo.toml
+++ b/crates/rust-analyzer/Cargo.toml
@@ -31,6 +31,7 @@ serde_json = { version = "1.0.48", features = ["preserve_order"] }
 threadpool = "1.7.1"
 rayon = "1.5"
 mimalloc = { version = "0.1.19", default-features = false, optional = true }
+dhat = { version = "0.1.1", optional = true }
 lsp-server = "0.5.0"
 tracing = "0.1"
 tracing-subscriber = { version = "0.2", default-features = false, features = ["env-filter", "registry"] }
diff --git a/crates/rust-analyzer/src/bin/main.rs b/crates/rust-analyzer/src/bin/main.rs
index defdcbd74..5c6502d63 100644
--- a/crates/rust-analyzer/src/bin/main.rs
+++ b/crates/rust-analyzer/src/bin/main.rs
@@ -19,7 +19,14 @@ use vfs::AbsPathBuf;
 #[global_allocator]
 static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;
 
+#[cfg(feature = "dhat")]
+#[global_allocator]
+static ALLOC: dhat::DhatAlloc = dhat::DhatAlloc;
+
 fn main() {
+    #[cfg(feature = "dhat")]
+    let _dhat = dhat::Dhat::start_heap_profiling();
+
     if let Err(err) = try_main() {
         eprintln!("{}", err);
         process::exit(101);

Running this command:

cd crates/rust-analyzer
cargo run --bin rust-analyzer --release --features=dhat -- analysis-stats --quiet --memory-usage ../..

...results in different panics and assertion failures:

Assertion failure and double free
thread '<unnamed>' panicked at 'assertion failed: matches!(old, None)', /home/jonas/.cargo/registry/src/github.com-1ecc6299db9ec823/dhat-0.1.1/src/lib.rs:301:17
stack backtrace:
   0: std::panicking::begin_panic
   1: std::thread::local::LocalKey<T>::with
   2: <dhat::DhatAlloc as core::alloc::global::GlobalAlloc>::realloc
   3: alloc::alloc::realloc
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/alloc/src/alloc.rs:110
   4: alloc::alloc::Global::grow_impl
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/alloc/src/alloc.rs:185
   5: <alloc::alloc::Global as core::alloc::AllocRef>::grow
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/alloc/src/alloc.rs:237
   6: alloc::raw_vec::finish_grow
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/alloc/src/raw_vec.rs:491
   7: alloc::raw_vec::RawVec<T,A>::grow_amortized
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/alloc/src/raw_vec.rs:427
   8: alloc::raw_vec::RawVec<T,A>::try_reserve
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/alloc/src/raw_vec.rs:316
   9: alloc::raw_vec::RawVec<T,A>::reserve
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/alloc/src/raw_vec.rs:310
  10: alloc::vec::Vec<T>::reserve
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/alloc/src/vec.rs:505
  11: alloc::vec::Vec<T>::append_elements
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/alloc/src/vec.rs:1270
  12: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<&T,core::slice::iter::Iter<T>>>::spec_extend
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/alloc/src/vec.rs:2416
  13: alloc::vec::Vec<T>::extend_from_slice
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/alloc/src/vec.rs:1601
  14: std::sys_common::os_str_bytes::Buf::push_slice
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/sys_common/os_str_bytes.rs:128
  15: std::ffi::os_str::OsString::push
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/ffi/os_str.rs:167
  16: std::path::PathBuf::_push
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/path.rs:1181
  17: std::path::PathBuf::push
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/path.rs:1152
  18: std::path::Path::_join
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/path.rs:2145
  19: std::path::Path::join
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/path.rs:2140
  20: std::sys::unix::fs::DirEntry::path
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/sys/unix/fs.rs:500
  21: std::fs::DirEntry::path
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/fs.rs:1382
  22: walkdir::dent::DirEntry::from_entry
  23: <walkdir::IntoIter as core::iter::traits::iterator::Iterator>::next
  24: <walkdir::FilterEntry<walkdir::IntoIter,P> as core::iter::traits::iterator::Iterator>::next
  25: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::spec_extend
  26: vfs_notify::NotifyActor::run
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
free(): double free detected in tcache 2
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "PoisonError { inner: .. }"', /home/jonas/.cargo/registry/src/github.com-1ecc6299db9ec823/dhat-0.1.1/src/lib.rs:fish: “cargo run --bin rust-analyzer -…” terminated by signal SIGABRT (Abort)
Double (triple?) panic
thread '<unnamed>' panicked at 'assertion failed: matches!(old, None)', /home/jonas/.cargo/registry/src/github.com-1ecc6299db9ec823/dhat-0.1.1/src/lib.rs:301:17
stack backtrace:
   0: std::panicking::begin_panic
   1: std::thread::local::LocalKey<T>::with
   2: <dhat::DhatAlloc as core::alloc::global::GlobalAlloc>::realloc
   3: alloc::alloc::realloc
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/alloc/src/alloc.rs:110
   4: alloc::alloc::Global::grow_impl
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/alloc/src/alloc.rs:185
   5: <alloc::alloc::Global as core::alloc::AllocRef>::grow
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/alloc/src/alloc.rs:237
   6: alloc::raw_vec::finish_grow
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/alloc/src/raw_vec.rs:491
   7: alloc::raw_vec::RawVec<T,A>::grow_amortized
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/alloc/src/raw_vec.rs:427
   8: alloc::raw_vec::RawVec<T,A>::try_reserve
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/alloc/src/raw_vec.rs:316
   9: alloc::raw_vec::RawVec<T,A>::reserve
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/alloc/src/raw_vec.rs:310
  10: alloc::vec::Vec<T>::reserve
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/alloc/src/vec.rs:505
  11: alloc::vec::Vec<T>::append_elements
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/alloc/src/vec.rs:1270
  12: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<&T,core::slice::iter::Iter<T>>>::spec_extend
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/alloc/src/vec.rs:2416
  13: alloc::vec::Vec<T>::extend_from_slice
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/alloc/src/vec.rs:1601
  14: std::sys_common::os_str_bytes::Buf::push_slice
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/sys_common/os_str_bytes.rs:128
  15: std::ffi::os_str::OsString::push
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/ffi/os_str.rs:167
  16: std::path::PathBuf::_push
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/path.rs:1181
  17: std::path::PathBuf::push
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/path.rs:1152
  18: std::path::Path::_join
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/path.rs:2145
  19: std::path::Path::join
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/path.rs:2140
  20: std::sys::unix::fs::DirEntry::path
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/sys/unix/fs.rs:500
  21: std::fs::DirEntry::path
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/fs.rs:1382
  22: walkdir::dent::DirEntry::from_entry
  23: <walkdir::IntoIter as core::iter::traits::iterator::Iterator>::next
  24: <walkdir::FilterEntry<walkdir::IntoIter,P> as core::iter::traits::iterator::Iterator>::next
  25: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::spec_extend
  26: vfs_notify::NotifyActor::run
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "PoisonError { inner: .. }"', /home/jonas/.cargo/registry/src/github.com-1ecc6299db9ec823/dhat-0.1.1/src/lib.rs:316:66
stack backtrace:
   0: rust_begin_unwind
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:483
   1: core::panicking::panic_fmt
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/panicking.rs:85
   2: core::option::expect_none_failed
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/option.rs:1234
   3: std::thread::local::LocalKey<T>::with
   4: <dhat::DhatAlloc as core::alloc::global::GlobalAlloc>::dealloc
   5: vfs::path_interner::PathInterner::intern
   6: vfs::Vfs::set_file_contents
   7: rust_analyzer::cli::load_cargo::load_cargo
   8: rust_analyzer::cli::analysis_stats::AnalysisStatsCmd::run
   9: rust_analyzer::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/jonas/.cargo/registry/src/github.com-1ecc6299db9ec823/dhat-0.1.1/src/lib.rs:542:15
stack backtrace:
   0:     0x56081e718f10 - std::backtrace_rs::backtrace::libunwind::trace::h72c2fb8038f1bbee
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/../../backtrace/src/backtrace/libunwind.rs:96
   1:     0x56081e718f10 - std::backtrace_rs::backtrace::trace_unsynchronized::h1e3b084883f1e78c
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/../../backtrace/src/backtrace/mod.rs:66
   2:     0x56081e718f10 - std::sys_common::backtrace::_print_fmt::h3bf6a7ebf7f0394a
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/sys_common/backtrace.rs:79
   3:     0x56081e718f10 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h2e8cb764b7fe02e7
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/sys_common/backtrace.rs:58
   4:     0x56081e74006c - core::fmt::write::h7a1184eaee6a8644
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/fmt/mod.rs:1080
   5:     0x56081e712a62 - std::io::Write::write_fmt::haeeb374d93a67eac
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/io/mod.rs:1516
   6:     0x56081e71b40d - std::sys_common::backtrace::_print::h1d14a7f6ad632dc8
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/sys_common/backtrace.rs:61
   7:     0x56081e71b40d - std::sys_common::backtrace::print::h301abac8bb2e3e81
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/sys_common/backtrace.rs:48
   8:     0x56081e71b40d - std::panicking::default_hook::{{closure}}::hde0cb80358a6920a
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:208
   9:     0x56081e71b0b8 - std::panicking::default_hook::h9b1a691049a0ec8f
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:227
  10:     0x56081e71baf1 - std::panicking::rust_panic_with_hook::h2bdec87b60580584
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:577
  11:     0x56081e71b699 - std::panicking::begin_panic_handler::{{closure}}::h101ca09d9df5db47
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:484
  12:     0x56081e71937c - std::sys_common::backtrace::__rust_end_short_backtrace::h3bb85654c20113ca
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/sys_common/backtrace.rs:153
  13:     0x56081e71b659 - rust_begin_unwind
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:483
  14:     0x56081e73dc61 - core::panicking::panic_fmt::h48c31e1e3d550146
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/panicking.rs:85
  15:     0x56081e73dbad - core::panicking::panic::h184ede6dd822ffb4
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/panicking.rs:50
  16:     0x56081da9a2cd - <dhat::Dhat as core::ops::drop::Drop>::drop::h0a45d9344a935abe
  17:     0x56081da00665 - rust_analyzer::main::hb8a869c11f5a510f
  18:     0x56081d9f9c73 - std::sys_common::backtrace::__rust_begin_short_backtrace::h4fe9e15942c2cdb2
  19:     0x56081da05059 - std::rt::lang_start::{{closure}}::h1812fd355e84b98b
  20:     0x56081e71c007 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::he179d32a5d10d957
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/ops/function.rs:259
  21:     0x56081e71c007 - std::panicking::try::do_call::hcb3d5e7be089b2b4
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:381
  22:     0x56081e71c007 - std::panicking::try::h7ac93b0cd56fb701
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:345
  23:     0x56081e71c007 - std::panic::catch_unwind::h7b40e396c93a4fcd
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panic.rs:382
  24:     0x56081e71c007 - std::rt::lang_start_internal::h142b9cc66267fea1
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/rt.rs:51
  25:     0x56081da00732 - main
  26:     0x7f5d70414152 - __libc_start_main
  27:     0x56081d9c90ae - _start
  28:                0x0 - <unknown>
thread panicked while panicking. aborting.

Any idea what I could have unearthed here?

dhat-rs doesn't work on platforms where pthread_setspecific is used for TLS

Currently, dhat-rs uses TLS to store IGNORE_ALLOCS, which is used by the customer allocator. However, there are three different flavors of TLS implementation in Rust: static (the platform doesn't have threads, so this uses static global vars), fast (the one that Linux and macOS on x86_64 use) and os, which delegates the TLS management to pthread_setspecific.

The problem is that in the case where pthread_setspecific is used, Rust will allocate, which can then invoke the allocator. This causes failures on at least two platforms that I've tested (FreeBSD 13.2, OpenBSD 7.3 and -current) trying to call any code that uses dhat's custom allocator. There are more platforms affected by this (Illumos, maybe AArch64 macOS?, android, and more) based on how they also use pthread_setspecific, but I haven't tested.

You can see more details in the Rust source:

https://github.com/rust-lang/rust/blob/master/library/std/src/sys/common/thread_local/mod.rs
The allocation in question: https://github.com/rust-lang/rust/blob/db4a1534402a163f9296347d31796f070ae7c4e1/library/std/src/sys/common/thread_local/os_local.rs#L145

I'm pretty sure the above is where the issue lies? I'm not really sure how best to resolve this, since the state of whether or not to track allocations needs to be shared between all of the different objects in the library, so it's not like the tracking of that can be made object-local.

DHAT hangs

I noticed that the program I'm trying to monitor with dhat hangs when it is about to exit in some cases.
Program prints stuff to stderr to report progress and around the exit - this might be important.

I attached to the process with the debugger and found this in a backtrace when it was hanging.

#0  syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1  0x000055e311833c64 in std::sys::unix::futex::futex_wait () at library/std/src/sys/unix/futex.rs:62
#2  std::sys::unix::locks::futex_mutex::Mutex::lock_contended () at library/std/src/sys/unix/locks/futex_mutex.rs:56
#3  0x000055e31185abff in std::sys::unix::locks::futex_mutex::Mutex::lock () at library/std/src/sys/unix/locks/futex_mutex.rs:28
#4  std::sync::remutex::ReentrantMutex::lock<core::cell::RefCell<std::io::stdio::StderrRaw>> () at library/std/src/sync/remutex.rs:103
#5  std::io::stdio::Stderr::lock () at library/std/src/io/stdio.rs:888
#6  std::io::stdio::{impl#19}::write_fmt () at library/std/src/io/stdio.rs:947
#7  0x000055e31185b859 in std::io::stdio::{impl#18}::write_fmt () at library/std/src/io/stdio.rs:921
#8  std::io::stdio::print_to<std::io::stdio::Stderr> () at library/std/src/io/stdio.rs:1020
#9  std::io::stdio::_eprint () at library/std/src/io/stdio.rs:1108
#10 0x000055e31113df01 in dhat::Globals::finish (self=..., memory_output=<error reading variable: Cannot access memory at address 0x0>) at src/lib.rs:762
#11 0x000055e311094a2c in dhat::Profiler::drop_inner (memory_output=<error reading variable: Cannot access memory at address 0x0>, self=<optimized out>)

Not sure what to make of it. I'm using a local fork of dhat with eprintln! removed as a workaround - seem to work.

dhat::Profiler::builder().testing() can not be used in multiple tests

This is probably a documentation issue more than an implementation one: The profiler created by dhat's ::testing() constructor can't be created in multiple tests in the same test module (as they're run concurrently), e.g.:

use std::time::Duration;

#[global_allocator]
static ALLOC: dhat::Alloc = dhat::Alloc;

#[test]
fn dhat() {
    let _profiler = dhat::Profiler::builder().testing().build();
    std::thread::sleep(Duration::from_secs(1));
}

#[test]
fn dhat_2() {
    let _profiler = dhat::Profiler::builder().testing().build();
}

results in:

/run/current-system/sw/bin/cargo test dhat --manifest-path /Users/asf/Hacks/governor/governor/Cargo.toml  
   Compiling governor v0.5.1 (/Users/asf/Hacks/governor/governor)
    Finished test [unoptimized + debuginfo] target(s) in 0.21s
     Running unittests src/lib.rs (target/debug/deps/governor-cc28a8ac1de4c043)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 22 filtered out; finished in 0.00s

     Running tests/dhat.rs (target/debug/deps/dhat-cd6f2811541d9160)

running 2 tests
test dhat_2 ... FAILED
test dhat ... ok

failures:

---- dhat_2 stdout ----
thread 'dhat_2' panicked at 'dhat: creating a profiler while a profiler is already running', /Users/asf/.cargo/registry/src/github.com-1ecc6299db9ec823/dhat-0.3.2/src/lib.rs:1148:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    dhat_2

test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.01s

I'm not sure if dhat's testing profiler can include a mutex (which would change test semantics), but the docs ought to call out the perils of concurrent tests in the same test module (:

Dump JSON from profiler on demand

I recently was in a situation where I wanted to use dhat to grab the json blob from a process while it was running without stopping it or having it drop the profiler. It would be nice if I could use a method on the profiler to dump the json to a string on demand, as I could then use a signal handler or IPC call to dump the json output.

How to revue the results on windows

I am a Windows based lifeform, so don't have the pleasure of Valgrind experience. Does the DHAT's viewer work on windows? I could not figure that out from the Valgrind website. How would I get it set up?

Error: data file contains a repeated location (1)

When running dhat 0.3.2 with rustc 1.68.0 (2c8cc3432 2023-03-06) on my MacBook Pro with apple silicon and the following configuration:

#[cfg(feature = "dhat-heap")]
#[global_allocator]
static ALLOC: dhat::Alloc = dhat::Alloc;

fn main() {

    #[cfg(feature = "dhat-heap")]
        let _profiler = dhat::Profiler::new_heap();
    #[cfg(feature = "dhat-heap")]
        println!("lets profile!");
    ...
}

I get the following output:

dhat: Total:     2,197,613,072 bytes in 140,839 blocks
dhat: At t-gmax: 84,232,363 bytes in 22,743 blocks
dhat: At t-end:  4,467,522 bytes in 256 blocks
dhat: The data has been saved to dhat-heap.json, and is viewable with dhat/dh_view.html

but when trying to open the json file either in the web viewer or with with the html from the cloned repo, I get the following error:
Error: data file contains a repeated location (1)

The json itself is attached.
dhat-heap.json.zip

`live_block.remove` panics on MacOS

Heya; me and a co-worker were trying out dhat on our work codebase to get a sense of where we're allocating, and we reliably managed to get it to panic... but only on MacOS. Testing showed that Linux was not affected.

We made sure to run Dhat::start_heap_profiling as the very first thing in the program, but that didn't change a thing. Unfortunately I didn't get to validate whether this also happens on Windows. Unfortunately our work codebase isn't the most friendly to setup (scala + Rust), so I don't have a repro right now. We were hoping that perhaps sharing the stack trace might be enough to reason about what could be causing this.

Thanks heaps!

System Details

  • OS: MacOS (I believe Catalina)
  • Rust version: 1.49

Source of panic

The unwrap call here seems to be causing the panic.

dhat-rs/src/lib.rs

Lines 305 to 308 in bfbd533

let LiveBlock {
pp_info_idx,
allocation_instant: _,
} = h.live_blocks.remove(&(old_ptr as usize)).unwrap();

Usage

image

Stack Trace

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/dhat-0.2.2/src/lib.rs:308:67
stack backtrace:
   0: rust_begin_unwind
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:495:5
   1: core::panicking::panic_fmt
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/core/src/panicking.rs:92:14
   2: core::panicking::panic
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/core/src/panicking.rs:50:5
   3: core::option::Option::unwrap
             at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/option.rs:386:21
   4: ::realloc::{{closure}}
             at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/dhat-0.2.2/src/lib.rs:308:25
   5: dhat::if_ignoring_allocs_else
             at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/dhat-0.2.2/src/lib.rs:620:9
   6: ::realloc
             at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/dhat-0.2.2/src/lib.rs:283:9
   7: __rg_realloc
             at ./query-engine/query-engine/src/main.rs:31:1
   8: alloc::alloc::realloc
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/alloc/src/alloc.rs:120:14
   9: alloc::alloc::Global::grow_impl
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/alloc/src/alloc.rs:196:31
  10: ::grow
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/alloc/src/alloc.rs:249:18
  11: alloc::raw_vec::finish_grow
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/alloc/src/raw_vec.rs:492:13
  12: alloc::raw_vec::RawVec::grow_amortized
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/alloc/src/raw_vec.rs:428:19
  13: alloc::raw_vec::RawVec::try_reserve
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/alloc/src/raw_vec.rs:317:13
  14: alloc::raw_vec::RawVec::reserve
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/alloc/src/raw_vec.rs:311:24
  15: alloc::vec::Vec::reserve
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/alloc/src/vec.rs:505:9
  16: alloc::vec::Vec::push
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/alloc/src/vec.rs:1210:13
  17: std::sys::unix::thread_local_dtor::register_dtor
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/sys/unix/thread_local_dtor.rs:82:5
  18: std::thread::local::fast::Key::try_register_dtor
             at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:490:30
  19: std::thread::local::fast::Key::try_initialize
             at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:471:52
  20: std::thread::local::fast::Key::get
             at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:456:29
  21: tracing_core::dispatcher::CURRENT_STATE::__getit
             at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:183:26
  22: std::thread::local::LocalKey::try_with
             at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:271:32
  23: tracing_core::dispatcher::get_default
             at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-core-0.1.17/src/dispatcher.rs:334:5
  24: tracing_core::event::Event::dispatch
             at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-core-0.1.17/src/event.rs:34:9
  25: query_engine::exec_loader::sqlite::{{closure}}
             at ./query-engine/query-engine/src/exec_loader.rs:50:5
  26:  as core::future::future::Future>::poll
             at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  27: query_engine::exec_loader::load::{{closure}}
             at ./query-engine/query-engine/src/exec_loader.rs:20:31
  28:  as core::future::future::Future>::poll
             at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  29: query_engine::context::PrismaContext::new::{{closure}}
             at ./query-engine/query-engine/src/context.rs:59:35
  30:  as core::future::future::Future>::poll
             at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  31: query_engine::context::ContextBuilder::build::{{closure}}
             at ./query-engine/query-engine/src/context.rs:43:9
  32:  as core::future::future::Future>::poll
             at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  33: query_engine::server::listen::{{closure}}
             at ./query-engine/query-engine/src/server/mod.rs:56:14
  34:  as core::future::future::Future>::poll
             at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  35: query_engine::main::main::{{closure}}
             at ./query-engine/query-engine/src/main.rs:64:17
  36:  as core::future::future::Future>::poll
             at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  37: query_engine::main::{{closure}}
             at ./query-engine/query-engine/src/main.rs:47:16
  38:  as core::future::future::Future>::poll
             at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  39:  as core::future::future::Future>::poll::{{closure}}
             at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/task/builder.rs:199:17
  40: async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current::{{closure}}
             at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/task/task_locals_wrapper.rs:60:13
  41: std::thread::local::LocalKey::try_with
             at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:272:16
  42: std::thread::local::LocalKey::with
             at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:248:9
  43: async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current
             at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/task/task_locals_wrapper.rs:55:9
  44:  as core::future::future::Future>::poll
             at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/task/builder.rs:197:13
  45:  as core::future::future::Future>::poll
             at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-lite-1.11.3/src/future.rs:526:33
  46: async_executor::Executor::run::{{closure}}
             at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-executor-1.4.0/src/lib.rs:236:9
  47:  as core::future::future::Future>::poll
             at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  48: async_executor::LocalExecutor::run::{{closure}}
             at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-executor-1.4.0/src/lib.rs:437:9
  49:  as core::future::future::Future>::poll
             at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  50: async_io::driver::block_on
             at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-io-1.3.1/src/driver.rs:142:33
  51: async_global_executor::reactor::block_on::{{closure}}
             at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-global-executor-2.0.2/src/reactor.rs:3:18
  52: tokio::runtime::context::enter
             at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.24/src/runtime/context.rs:72:5
  53: tokio::runtime::handle::Handle::enter
             at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.24/src/runtime/handle.rs:76:9
  54: async_global_executor::tokio02::enter
             at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-global-executor-2.0.2/src/tokio02.rs:5:5
  55: async_global_executor::reactor::block_on::{{closure}}
             at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-global-executor-2.0.2/src/reactor.rs:9:18
  56: async_global_executor::reactor::block_on
             at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-global-executor-2.0.2/src/reactor.rs:12:5
  57: async_global_executor::executor::block_on::{{closure}}
             at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-global-executor-2.0.2/src/executor.rs:26:36
  58: std::thread::local::LocalKey::try_with
             at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:272:16
  59: std::thread::local::LocalKey::with
             at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:248:9
  60: async_global_executor::executor::block_on
             at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-global-executor-2.0.2/src/executor.rs:26:5
  61: async_std::task::builder::Builder::blocking::{{closure}}::{{closure}}
             at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/task/builder.rs:171:25
  62: async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current::{{closure}}
             at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/task/task_locals_wrapper.rs:60:13
  63: std::thread::local::LocalKey::try_with
             at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:272:16
  64: std::thread::local::LocalKey::with
             at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:248:9
  65: async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current
             at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/task/task_locals_wrapper.rs:55:9
  66: async_std::task::builder::Builder::blocking::{{closure}}
             at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/task/builder.rs:168:17
  67: std::thread::local::LocalKey::try_with
             at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:272:16
  68: std::thread::local::LocalKey::with
             at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:248:9
  69: async_std::task::builder::Builder::blocking
             at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/task/builder.rs:161:9
  70: async_std::task::block_on::block_on
             at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/task/block_on.rs:33:5
  71: query_engine::main
             at ./query-engine/query-engine/src/main.rs:46:12
  72: core::ops::function::FnOnce::call_once
             at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "PoisonError { inner: .. }"', /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/dhat-0.2.2/src/lib.rs:334:70
stack backtrace:
   0:        0x10cb179c4 - std::backtrace_rs::backtrace::libunwind::trace::h2973c0f115cf39cb
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/../../backtrace/src/backtrace/libunwind.rs:100:5
   1:        0x10cb179c4 - std::backtrace_rs::backtrace::trace_unsynchronized::h1a2874ce966099c0
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:        0x10cb179c4 - std::sys_common::backtrace::_print_fmt::h3b860fb438483fb1
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/sys_common/backtrace.rs:67:5
   3:        0x10cb179c4 - ::fmt::ha0848bb2602b5d05
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/sys_common/backtrace.rs:46:22
   4:        0x10cb3bf00 - core::fmt::write::h9f3ccac2ef682b93
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/core/src/fmt/mod.rs:1078:17
   5:        0x10cb10276 - std::io::Write::write_fmt::h0a47673aab280496
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/io/mod.rs:1518:15
   6:        0x10cb19c99 - std::sys_common::backtrace::_print::h9c13ab471b84d474
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/sys_common/backtrace.rs:49:5
   7:        0x10cb19c99 - std::sys_common::backtrace::print::h075217710b715efc
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/sys_common/backtrace.rs:36:9
   8:        0x10cb19c99 - std::panicking::default_hook::{{closure}}::h850c6aaf5e80c2f5
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:208:50
   9:        0x10cb1995d - std::panicking::default_hook::h037801299da6e1c6
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:227:9
  10:        0x10cb1a48b - std::panicking::rust_panic_with_hook::h76436d4cf7a368ac
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:593:17
  11:        0x10cb19f85 - std::panicking::begin_panic_handler::{{closure}}::h516c76d70abf04f6
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:499:13
  12:        0x10cb17e38 - std::sys_common::backtrace::__rust_end_short_backtrace::h653290b4f930faed
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/sys_common/backtrace.rs:141:18
  13:        0x10cb19eea - rust_begin_unwind
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:495:5
  14:        0x10cb3831f - core::panicking::panic_fmt::hde9134dd19c9a74f
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/core/src/panicking.rs:92:14
  15:        0x10cb38135 - core::option::expect_none_failed::h686aad664d56bca5
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/core/src/option.rs:1268:5
  16:        0x10b279a7c - core::result::Result::unwrap::h73801f9a467cc904
                               at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/result.rs:973:23
  17:        0x10b26e20d - ::dealloc::{{closure}}::h3a5c43f30a016ad0
                               at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/dhat-0.2.2/src/lib.rs:334:51
  18:        0x10b270dd9 - dhat::if_ignoring_allocs_else::h6c07a5088323fbb9
                               at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/dhat-0.2.2/src/lib.rs:620:9
  19:        0x10b26e165 - ::dealloc::h886afcab4a941290
                               at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/dhat-0.2.2/src/lib.rs:331:9
  20:        0x10b030a66 - __rg_dealloc
                               at /Users/dom/Documents/Repositories/prisma-engine/query-engine/query-engine/src/main.rs:31:1
  21:        0x10c3d28b6 - alloc::alloc::dealloc::h35a05910ca3a070c
                               at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/alloc.rs:102:14
  22:        0x10c3d2a03 - ::dealloc::h38598b7ff79f4dac
                               at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/alloc.rs:237:22
  23:        0x10c3d482c -  as core::ops::drop::Drop>::drop::h8b3d87c49259886a
                               at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/raw_vec.rs:505:22
  24:        0x10c3d2d91 - core::ptr::drop_in_place::h2db666b16eed2974
                               at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:175:1
  25:        0x10c3d2de2 - core::ptr::drop_in_place::hc22e67736e065a13
                               at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:175:1
  26:        0x10c3cd491 - core::ptr::drop_in_place::h8038abea3b766972
                               at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:175:1
  27:        0x10b715c95 - core::ptr::drop_in_place::hf77376c84d7c1028
                               at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:175:1
  28:        0x10b715b8f - core::ptr::drop_in_place::hf367e61b178a331d
                               at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:175:1
  29:        0x10b716aaf -  as core::ops::drop::Drop>::drop::he4991bf899aa9054
                               at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/vec.rs:2595:13
  30:        0x10b712f95 - core::ptr::drop_in_place::h9ab28f981ec874a5
                               at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:175:1
  31:        0x10b1fc625 - core::ptr::drop_in_place::h24791a4618dfcde6
                               at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:175:1
  32:        0x10b1c4fa1 - query_engine::context::PrismaContext::new::{{closure}}::hc975c1eda44da4b6
                               at /Users/dom/Documents/Repositories/prisma-engine/query-engine/query-engine/src/context.rs:82:5
  33:        0x10b0ab3fc -  as core::future::future::Future>::poll::h8a2b22c8cb7ca4b2
                               at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  34:        0x10b1c410e - query_engine::context::ContextBuilder::build::{{closure}}::h739d1058f8d5d90c
                               at /Users/dom/Documents/Repositories/prisma-engine/query-engine/query-engine/src/context.rs:43:9
  35:        0x10b0ae44c -  as core::future::future::Future>::poll::hf13be8c19b83415a
                               at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  36:        0x10affade0 - query_engine::server::listen::{{closure}}::h33874924f65fb2b7
                               at /Users/dom/Documents/Repositories/prisma-engine/query-engine/query-engine/src/server/mod.rs:56:14
  37:        0x10b0aecdc -  as core::future::future::Future>::poll::hfebb0a065984c97f
                               at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  38:        0x10b14ba49 - query_engine::main::main::{{closure}}::hc77539ce9b4ea1de
                               at /Users/dom/Documents/Repositories/prisma-engine/query-engine/query-engine/src/main.rs:64:17
  39:        0x10b0ad5fc -  as core::future::future::Future>::poll::hcb5ca57f746b5ef6
                               at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  40:        0x10b14b217 - query_engine::main::{{closure}}::h17b35517de4d50b1
                               at /Users/dom/Documents/Repositories/prisma-engine/query-engine/query-engine/src/main.rs:47:16
  41:        0x10b0ae965 -  as core::future::future::Future>::poll::hf5573b3330c23ad2
                               at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  42:        0x10b1e2ab7 -  as core::future::future::Future>::poll::{{closure}}::heb2e32b983b7f46e
                               at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/task/builder.rs:199:17
  43:        0x10b18a342 - async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current::{{closure}}::h11ea09361d14d498
                               at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/task/task_locals_wrapper.rs:60:13
  44:        0x10aff2d5a - std::thread::local::LocalKey::try_with::he5304306024c7bc0
                               at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:272:16
  45:        0x10aff0fbe - std::thread::local::LocalKey::with::h012b63c606850a41
                               at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:248:9
  46:        0x10b18a11e - async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current::h70648ebf2ed5ad8f
                               at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/task/task_locals_wrapper.rs:55:9
  47:        0x10b1e2863 -  as core::future::future::Future>::poll::hace2a0972c998446
                               at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/task/builder.rs:197:13
  48:        0x10b0592e7 -  as core::future::future::Future>::poll::h0f4f1362bb16a2b1
                               at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-lite-1.11.3/src/future.rs:526:33
  49:        0x10b03a158 - async_executor::Executor::run::{{closure}}::hce6550358ab74bf6
                               at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-executor-1.4.0/src/lib.rs:236:9
  50:        0x10b0ac525 -  as core::future::future::Future>::poll::ha87634dbbcf604a5
                               at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  51:        0x10b039d13 - async_executor::LocalExecutor::run::{{closure}}::hae025dfc18389d25
                               at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-executor-1.4.0/src/lib.rs:437:9
  52:        0x10b0a89e5 -  as core::future::future::Future>::poll::h418029a55065577b
                               at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  53:        0x10aff762b - async_io::driver::block_on::h16633f5069f05a44
                               at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-io-1.3.1/src/driver.rs:142:33
  54:        0x10b001599 - async_global_executor::reactor::block_on::{{closure}}::he54056f5545333a6
                               at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-global-executor-2.0.2/src/reactor.rs:3:18
  55:        0x10b0c139e - tokio::runtime::context::enter::he304eb3673b1d01b
                               at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.24/src/runtime/context.rs:72:5
  56:        0x10b25f436 - tokio::runtime::handle::Handle::enter::h492823f8255e3f79
                               at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.24/src/runtime/handle.rs:76:9
  57:        0x10b0a2068 - async_global_executor::tokio02::enter::h4ad35a32ff99d866
                               at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-global-executor-2.0.2/src/tokio02.rs:5:5
  58:        0x10b001529 - async_global_executor::reactor::block_on::{{closure}}::ha1ac31cf269584ba
                               at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-global-executor-2.0.2/src/reactor.rs:9:18
  59:        0x10b0014b7 - async_global_executor::reactor::block_on::hae8a87b42e8273a8
                               at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-global-executor-2.0.2/src/reactor.rs:12:5
  60:        0x10b0fb3c1 - async_global_executor::executor::block_on::{{closure}}::hd6e552a578005285
                               at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-global-executor-2.0.2/src/executor.rs:26:36
  61:        0x10aff1f3b - std::thread::local::LocalKey::try_with::h61ed96b8e7674c18
                               at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:272:16
  62:        0x10aff122e - std::thread::local::LocalKey::with::h56a3d3b83315c7db
                               at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:248:9
  63:        0x10b0fb328 - async_global_executor::executor::block_on::h9362f1a7ae5db55a
                               at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-global-executor-2.0.2/src/executor.rs:26:5
  64:        0x10b1e4de8 - async_std::task::builder::Builder::blocking::{{closure}}::{{closure}}::hbcb3256aebfbbe07
                               at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/task/builder.rs:171:25
  65:        0x10b18a622 - async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current::{{closure}}::hb122fc98ecb05f7c
                               at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/task/task_locals_wrapper.rs:60:13
  66:        0x10aff2f8b - std::thread::local::LocalKey::try_with::hfdcb50036d7ee184
                               at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:272:16
  67:        0x10aff15ce - std::thread::local::LocalKey::with::hd400293e59a93e0f
                               at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:248:9
  68:        0x10b18a196 - async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current::hc25a16df8b3c75ea
                               at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/task/task_locals_wrapper.rs:55:9
  69:        0x10b1e4caf - async_std::task::builder::Builder::blocking::{{closure}}::h589ea6e79b64c6c1
                               at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/task/builder.rs:168:17
  70:        0x10aff24bb - std::thread::local::LocalKey::try_with::h970f1d500bdc4bc0
                               at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:272:16
  71:        0x10aff16fe - std::thread::local::LocalKey::with::hf4929ba8eab68ba9
                               at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:248:9
  72:        0x10b1e4b72 - async_std::task::builder::Builder::blocking::h2fec1f2b9745435c
                               at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/task/builder.rs:161:9
  73:        0x10b1efedb - async_std::task::block_on::block_on::h21d9d2bb13f6cfb6
                               at /Users/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/task/block_on.rs:33:5
  74:        0x10b030522 - query_engine::main::hbf23f1b8c38eee50
                               at /Users/dom/Documents/Repositories/prisma-engine/query-engine/query-engine/src/main.rs:46:12
  75:        0x10b1f83ce - core::ops::function::FnOnce::call_once::h26235216cd0325c3
                               at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
  76:        0x10b0015d1 - std::sys_common::backtrace::__rust_begin_short_backtrace::ha40f3fc559c736df
                               at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys_common/backtrace.rs:125:18
  77:        0x10b219a44 - std::rt::lang_start::{{closure}}::h7a090c4042ade07c
                               at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs:66:18
  78:        0x10cb1a8e4 - core::ops::function::impls:: for &F>::call_once::h81f763a559f81b5c
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/core/src/ops/function.rs:259:13
  79:        0x10cb1a8e4 - std::panicking::try::do_call::h8f7e7501b4b6c841
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:381:40
  80:        0x10cb1a8e4 - std::panicking::try::h5def58989e0f2c84
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:345:19
  81:        0x10cb1a8e4 - std::panic::catch_unwind::h8210e1d7d92e8f91
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panic.rs:396:14
  82:        0x10cb1a8e4 - std::rt::lang_start_internal::h36ccce6e8a047133
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/rt.rs:51:25
  83:        0x10b219a21 - std::rt::lang_start::h18776d25f963b472
                               at /Users/dom/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/rt.rs:65:5
  84:        0x10b030b42 - _main
thread panicked while panicking. aborting.

DHAT hangs

Hello,

I'm having a similar issue to #25 where my program, when running with the dhat allocator hangs.

This seems related to backtrace collection:

(lldb) thread b 2
  thread #2, name = 'test_bgp_origin'
    frame #0: 0x000055555585d6dc dhat_bgp_originate-f82b65681502d053`mintex::Mutex$LT$T$GT$::lock::h72ad4838d4d3a11d(self=0x0000555556bb0330) at lib.rs:65:19
    frame #1: 0x000055555583e02b dhat_bgp_originate-f82b65681502d053`_$LT$dhat..Alloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$::realloc::h09bd1dadf21796a0(self=0x000055555672a2ab, old_ptr="\U00000001", layout=Layout @ 0x00007ffff7cc81e8, new_size=3584) at lib.rs:1251:51
    frame #2: 0x0000555555819683 dhat_bgp_originate-f82b65681502d053`__rust_realloc(arg0="\U00000001", arg1=1792, arg2=8, arg3=3584) at dhat_bgp_originate.rs:40:15
    frame #3: 0x000055555666a29a dhat_bgp_originate-f82b65681502d053`alloc::alloc::Global::grow_impl::hd18a19f867acb51a [inlined] alloc::alloc::realloc::h964c149612511afa(ptr="\U00000001", layout=Layout @ 0x00007ffff7cc8518, new_size=3584) at alloc.rs:140:14
    frame #4: 0x000055555666a24c dhat_bgp_originate-f82b65681502d053`alloc::alloc::Global::grow_impl::hd18a19f867acb51a(self=0x00007ffff7cc9158, ptr=(pointer = "\U00000001"), old_layout=Layout @ 0x00007ffff7cc84e8, new_layout=Layout @ 0x00007ffff7cc84f8, zeroed=false) at alloc.rs:217:31
    frame #5: 0x000055555666a6b0 dhat_bgp_originate-f82b65681502d053`_$LT$alloc..alloc..Global$u20$as$u20$core..alloc..Allocator$GT$::grow::h6ca616e266c3d9bf(self=0x00007ffff7cc9158, ptr=(pointer = "\U00000001"), old_layout=Layout @ 0x00007ffff7cc8718, new_layout=Layout @ 0x00007ffff7cc8728) at alloc.rs:270:18
    frame #6: 0x0000555556669522 dhat_bgp_originate-f82b65681502d053`alloc::raw_vec::finish_grow::h91c9a9cb3a8d6648(new_layout=Result<core::alloc::layout::Layout, core::alloc::layout::LayoutError> @ 0x00007ffff7cc8858, current_memory=Option<(core::ptr::non_null::NonNull<u8>, core::alloc::layout::Layout)> @ 0x00007ffff7cc8a00, alloc=0x00007ffff7cc9158) at raw_vec.rs:472:13
    frame #7: 0x00005555565d2a29 dhat_bgp_originate-f82b65681502d053`alloc::raw_vec::RawVec$LT$T$C$A$GT$::grow_amortized::ha3a5dbf65c921676(self=0x00007ffff7cc9158, len=32, additional=1) at raw_vec.rs:404:19
    frame #8: 0x00005555565d3199 dhat_bgp_originate-f82b65681502d053`alloc::raw_vec::RawVec$LT$T$C$A$GT$::reserve_for_push::hb8093cccd384d669(self=0x00007ffff7cc9158, len=32) at raw_vec.rs:302:24
    frame #9: 0x00005555565d38ee dhat_bgp_originate-f82b65681502d053`alloc::vec::Vec$LT$T$C$A$GT$::push::h4ef4cacd71132877(self=0x00007ffff7cc9158, value=BacktraceFrame @ 0x00007ffff7cc8c60) at mod.rs:1828:13
    frame #10: 0x00005555565cc1da dhat_bgp_originate-f82b65681502d053`anyhow::backtrace::capture::Backtrace::create::_$u7b$$u7b$closure$u7d$$u7d$::h1d20a3049ba382a1(frame=0x00007ffff7cc8d40) at backtrace.rs:217:17
    frame #11: 0x00005555565f0943 dhat_bgp_originate-f82b65681502d053`core::ops::function::impls::_$LT$impl$u20$core..ops..function..FnMut$LT$A$GT$$u20$for$u20$$RF$mut$u20$F$GT$::call_mut::hd906021a43fd6b3a(self=0x00007ffff7cc9098, args=(&backtrace::backtrace::Frame) @ 0x00007ffff7cc8d08) at function.rs:294:13
    frame #12: 0x000055555660fb70 dhat_bgp_originate-f82b65681502d053`backtrace::backtrace::libunwind::trace::trace_fn::h2d05dcca6e0b2934(ctx=0x00007ffff7cc8dd0, arg=0x00007ffff7cc9098) at libunwind.rs:105:26
    frame #13: 0x00007ffff7fa6664 libgcc_s.so.1`_Unwind_Backtrace + 212
    frame #14: 0x00005555565ca50a dhat_bgp_originate-f82b65681502d053`backtrace::backtrace::trace_unsynchronized::hc4aaf54ef431d84c [inlined] backtrace::backtrace::libunwind::trace::h4252170f1a5aeec7(cb=&mut dyn core::ops::function::FnMut<(&backtrace::backtrace::Frame), Output=bool> @ 0x00007ffff7cc9098) at libunwind.rs:93:5
    frame #15: 0x00005555565ca4f5 dhat_bgp_originate-f82b65681502d053`backtrace::backtrace::trace_unsynchronized::hc4aaf54ef431d84c(cb=<unavailable>) at mod.rs:66:5
    frame #16: 0x00005555565ca5b2 dhat_bgp_originate-f82b65681502d053`backtrace::backtrace::trace::h83cd1b0fb300834b(cb={closure_env#0} @ 0x00007ffff7cc9180) at mod.rs:53:14
    frame #17: 0x00005555565cbf9e dhat_bgp_originate-f82b65681502d053`anyhow::backtrace::capture::Backtrace::create::h4febc7bf8250ab2a(ip=93825009499872) at backtrace.rs:216:13
    frame #18: 0x00005555565cbf24 dhat_bgp_originate-f82b65681502d053`anyhow::backtrace::capture::Backtrace::capture::heffd32e41bc285a0 at backtrace.rs:204:17
    frame #19: 0x000055555655e85f dhat_bgp_originate-f82b65681502d053`anyhow::private::new_adhoc::hb6e92295a89bc5aa(message=(data_ptr = "no event in sys channel", length = 23)) at lib.rs:632:36
[snip]

The other thread:

(lldb) thread b 3
  thread #3, name = 'flockd mock'
    frame #0: 0x00007ffff7dd0539 libc.so.6`syscall + 25
    frame #1: 0x0000555555706e84 dhat_bgp_originate-f82b65681502d053`std::sys::unix::locks::futex_mutex::Mutex::lock_contended::hbeb97827cd69d2db [inlined] std::sys::unix::futex::futex_wait::h3942933e6d137880 at futex.rs:62:21
    frame #2: 0x0000555555706e40 dhat_bgp_originate-f82b65681502d053`std::sys::unix::locks::futex_mutex::Mutex::lock_contended::hbeb97827cd69d2db at futex_mutex.rs:56:13
    frame #3: 0x000055555663759b dhat_bgp_originate-f82b65681502d053`std::sys::unix::locks::futex_mutex::Mutex::lock::h017642c2a4c9b3f7(self=0x00007ffff0000d30) at futex_mutex.rs:28:13
    frame #4: 0x00005555565e9365 dhat_bgp_originate-f82b65681502d053`std::sync::mutex::Mutex$LT$T$GT$::lock::haed0e33a58df9efe(self=0x00007ffff0000d30) at mutex.rs:273:13
    frame #5: 0x000055555663b1b8 dhat_bgp_originate-f82b65681502d053`backtrace::lock::lock::hfe5d8a30ad1f16b6 at lib.rs:185:28
    frame #6: 0x00005555558465dc dhat_bgp_originate-f82b65681502d053`backtrace::backtrace::trace::hb176e61194442b59(cb=<unavailable>) at mod.rs:52:18
    frame #7: 0x000055555583d776 dhat_bgp_originate-f82b65681502d053`dhat::new_backtrace_inner::h6d115f8baa267306(trim_backtraces=Option<usize> @ 0x00007ffff7ab6d70, frames_to_trim=0x0000555556bb0418) at lib.rs:1192:5
    frame #8: 0x000055555583de25 dhat_bgp_originate-f82b65681502d053`_$LT$dhat..Alloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$::alloc::h02222c84985aaf7e(self=0x000055555672a2ab, layout=Layout @ 0x00007ffff7ab6e98) at lib.rs:1235:26
    frame #9: 0x00005555558195b3 dhat_bgp_originate-f82b65681502d053`__rust_alloc(arg0=1120, arg1=8) at dhat_bgp_originate.rs:40:15
    frame #10: 0x000055555647c54e dhat_bgp_originate-f82b65681502d053`alloc::alloc::Global::alloc_impl::hc97dea3396771259 [inlined] alloc::alloc::alloc::hbf20be51a0187697(layout=Layout @ 0x00007ffff7ab70d0) at alloc.rs:102:9
    frame #11: 0x000055555647c4e1 dhat_bgp_originate-f82b65681502d053`alloc::alloc::Global::alloc_impl::hc97dea3396771259(self=0x00007ffff7ab79d8, layout=Layout @ 0x00007ffff7ab7080, zeroed=false) at alloc.rs:185:73
    frame #12: 0x000055555647ce49 dhat_bgp_originate-f82b65681502d053`_$LT$alloc..alloc..Global$u20$as$u20$core..alloc..Allocator$GT$::allocate::h1487027bb14d76e9(self=0x00007ffff7ab79d8, layout=Layout @ 0x00007ffff7ab7268) at alloc.rs:245:9
    frame #13: 0x0000555556482887 dhat_bgp_originate-f82b65681502d053`alloc::raw_vec::finish_grow::h261ffb947d013934(new_layout=Result<core::alloc::layout::Layout, core::alloc::layout::LayoutError> @ 0x00007ffff7ab7398, current_memory=Option<(core::ptr::non_null::NonNull<u8>, core::alloc::layout::Layout)> @ 0x00007ffff7ab7540, alloc=0x00007ffff7ab79d8) at raw_vec.rs:475:9
    frame #14: 0x0000555556012249 dhat_bgp_originate-f82b65681502d053`alloc::raw_vec::RawVec$LT$T$C$A$GT$::grow_amortized::h1b339c7e73182694(self=0x00007ffff7ab79d8, len=0, additional=1) at raw_vec.rs:404:19
    frame #15: 0x0000555556039c69 dhat_bgp_originate-f82b65681502d053`alloc::raw_vec::RawVec$LT$T$C$A$GT$::reserve_for_push::h884425a82cdf927b(self=0x00007ffff7ab79d8, len=0) at raw_vec.rs:302:24
    frame #16: 0x0000555556169f81 dhat_bgp_originate-f82b65681502d053`alloc::collections::vec_deque::VecDeque$LT$T$C$A$GT$::grow::h76670ef032cb9192(self=0x00007ffff7ab79d8) at mod.rs:2061:9
    frame #17: 0x000055555616e36a dhat_bgp_originate-f82b65681502d053`alloc::collections::vec_deque::VecDeque$LT$T$C$A$GT$::push_back::h901b552c9d675eeb(self=0x00007ffff7ab79d8, value=BgpConfEvent @ 0x00007ffff7ab7c28) at mod.rs:1659:13
[snip]

Running with RUST_BACKTRACE=0 fixes the problem.

Consider hosting a version of the viewer online

It would be nice if this utility pointed to a hosted version online. It could be as simple as a github.io static page. It's a bit confusing trying to find the viewer after running the example code. It would be nice to be able to open a link logged after running the example.

Unable to view dhat-heap.json - "data file is missing a field: mi"

Steps to reproduce:

  • Add dhat = "0.2.1" to a project
  • Create and run a simple cargo run --example.
➤ cargo run --example memory
    Finished dev [unoptimized + debuginfo] target(s) in 0.09s
     Running `/Users/greg/dev/icu4x/target/debug/examples/memory`
dhat: Total:     20,122 bytes in 129 blocks
dhat: At t-gmax: 9,328 bytes in 90 blocks
dhat: At t-end:  0 bytes in 0 blocks
dhat: The data in dhat-heap.json is viewable with dhat/dh_view.html
  • I'm not sure at this point what dhat/dh_view.html is referring to.
  • It's not located in the current directory.
  • Download https://www.valgrind.org/downloads/current.html
  • Open file:///Users/greg/Downloads/valgrind-3.16.1/dhat/dh_view.html
  • Click load button, and load dhat-heap.json
Uncaught Error: data file is missing a field: mi
    checkFields http://localhost:8000/dh_view.js:472
    buildTree http://localhost:8000/dh_view.js:509
    onload http://localhost:8000/dh_view.js:1351
    tryFunc http://localhost:8000/dh_view.js:265
    onload http://localhost:8000/dh_view.js:1341
    loadFile http://localhost:8000/dh_view.js:1340
  • Also try on git clone git://sourceware.org/git/valgrind.git
  • The error still reproduces.

Panic in `record_block`

Using dhat==0.3.0, I see a fairly reproducible (although non-deterministic) panic in record_block. Some smaller runs complete successfully, while larger runs generally encounter it before they can complete.

The Profiler is constructed via:

dhat::Profiler::builder()
  .file_name(path)
  .build()
thread 'tokio-runtime-worker' panicked at 'assertion failed: matches!(old, None)', /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/dhat-0.3.0/src/lib.rs:538:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:498:5
   1: core::panicking::panic_fmt
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/panicking.rs:107:14
   2: core::panicking::panic
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/panicking.rs:48:5
   3: dhat::Globals::record_block
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/dhat-0.3.0/src/lib.rs:538:9
   4: <dhat::Alloc as core::alloc::global::GlobalAlloc>::alloc
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/dhat-0.3.0/src/lib.rs:1230:17
   5: __rg_alloc
             at /Users/stuhood/src/pants/src/rust/engine/src/lib.rs:62:1
   6: alloc::alloc::alloc
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/alloc/src/alloc.rs:87:14
   7: alloc::alloc::Global::alloc_impl
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/alloc/src/alloc.rs:169:73
   8: <alloc::alloc::Global as core::alloc::Allocator>::allocate
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/alloc/src/alloc.rs:229:9
   9: alloc::raw_vec::RawVec<T,A>::allocate_in
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/alloc/src/raw_vec.rs:185:45
  10: alloc::raw_vec::RawVec<T,A>::with_capacity_in
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/alloc/src/raw_vec.rs:132:9
  11: alloc::vec::Vec<T,A>::with_capacity_in
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/alloc/src/vec/mod.rs:609:20
  12: <T as alloc::slice::hack::ConvertVec>::to_vec
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/alloc/src/slice.rs:204:27
  13: alloc::slice::hack::to_vec
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/alloc/src/slice.rs:176:9
  14: alloc::slice::<impl [T]>::to_vec_in
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/alloc/src/slice.rs:498:9
  15: <alloc::vec::Vec<T,A> as core::clone::Clone>::clone
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/alloc/src/vec/mod.rs:2480:9
  16: <glob::Pattern as core::clone::Clone>::clone
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/glob-0.3.0/src/lib.rs:486:5
  17: <T as alloc::slice::hack::ConvertVec>::to_vec
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/alloc/src/slice.rs:211:32
  18: alloc::slice::hack::to_vec
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/alloc/src/slice.rs:176:9
  19: alloc::slice::<impl [T]>::to_vec_in
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/alloc/src/slice.rs:498:9
  20: alloc::slice::<impl [T]>::to_vec
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/alloc/src/slice.rs:474:9
  21: fs::glob_matching::PathGlob::parse_globs
             at /Users/stuhood/src/pants/src/rust/engine/fs/src/glob_matching.rs:236:9
  22: fs::glob_matching::PathGlob::parse
             at /Users/stuhood/src/pants/src/rust/engine/fs/src/glob_matching.rs:157:5
  23: fs::glob_matching::PathGlob::spread_filespecs
             at /Users/stuhood/src/pants/src/rust/engine/fs/src/glob_matching.rs:101:19
  24: fs::glob_matching::PreparedPathGlobs::create
             at /Users/stuhood/src/pants/src/rust/engine/fs/src/glob_matching.rs:301:19
  25: fs::PathGlobs::parse
             at /Users/stuhood/src/pants/src/rust/engine/fs/src/lib.rs:425:5
  26: <engine::nodes::Snapshot as engine::nodes::WrappedNode>::run_wrapped_node::__run_wrapped_node::{{closure}}
             at /Users/stuhood/src/pants/src/rust/engine/src/nodes.rs:874:22
  27: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/future/mod.rs:80:19
  28: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/future/future.rs:119:9
  29: <F as futures_core::future::TryFuture>::try_poll
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.21/src/future.rs:82:9
  30: <futures_util::future::try_future::into_future::IntoFuture<Fut> as core::future::future::Future>::poll
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.21/src/future/try_future/into_future.rs:34:9
  31: <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.21/src/future/future/map.rs:55:37
  32: <futures_util::future::future::Map<Fut,F> as core::future::future::Future>::poll
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.21/src/lib.rs:91:13
  33: <futures_util::future::try_future::MapOk<Fut,F> as core::future::future::Future>::poll
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.21/src/lib.rs:91:13
  34: <engine::nodes::NodeKey as graph::node::Node>::run::__run::{{closure}}::{{closure}}::{{closure}}
             at /Users/stuhood/src/pants/src/rust/engine/src/nodes.rs:1467:13
  35: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/future/mod.rs:80:19
  36: <engine::nodes::NodeKey as graph::node::Node>::run::__run::{{closure}}::{{closure}}
             at /Users/stuhood/src/pants/src/rust/engine/workunit_store/src/lib.rs:855:24
  37: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/future/mod.rs:80:19
  38: <tokio::task::task_local::TaskLocalFuture<T,F> as core::future::future::Future>::poll::{{closure}}
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/task/task_local.rs:280:28
  39: tokio::task::task_local::TaskLocalFuture<T,F>::with_task
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/task/task_local.rs:272:9
  40: <tokio::task::task_local::TaskLocalFuture<T,F> as core::future::future::Future>::poll
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/task/task_local.rs:280:9
  41: workunit_store::scope_task_workunit_store_handle::{{closure}}
             at /Users/stuhood/src/pants/src/rust/engine/workunit_store/src/lib.rs:960:3
  42: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/future/mod.rs:80:19
  43: <engine::nodes::NodeKey as graph::node::Node>::run::__run::{{closure}}
             at /Users/stuhood/src/pants/src/rust/engine/src/nodes.rs:1412:5
  44: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/future/mod.rs:80:19
  45: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/future/future.rs:119:9
  46: graph::entry::Entry<N>::spawn_node_execution::{{closure}}
             at /Users/stuhood/src/pants/src/rust/engine/graph/src/entry.rs:347:19
  47: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/future/mod.rs:80:19
  48: graph::entry::Entry<N>::spawn_node_execution::{{closure}}::{{closure}}
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/macros/select.rs:505:49
  49: <tokio::future::poll_fn::PollFn<F> as core::future::future::Future>::poll
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/future/poll_fn.rs:38:9
  50: graph::entry::Entry<N>::spawn_node_execution::{{closure}}
             at /Users/stuhood/src/pants/src/rust/engine/graph/src/entry.rs:354:23
  51: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/future/mod.rs:80:19
  52: <tokio::task::task_local::TaskLocalFuture<T,F> as core::future::future::Future>::poll::{{closure}}
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/task/task_local.rs:280:28
  53: tokio::task::task_local::TaskLocalFuture<T,F>::with_task
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/task/task_local.rs:272:9
  54: <tokio::task::task_local::TaskLocalFuture<T,F> as core::future::future::Future>::poll
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/task/task_local.rs:280:9
  55: workunit_store::scope_task_workunit_store_handle::{{closure}}
             at /Users/stuhood/src/pants/src/rust/engine/workunit_store/src/lib.rs:960:3
  56: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/future/mod.rs:80:19
  57: task_executor::Executor::future_with_correct_context::{{closure}}
             at /Users/stuhood/src/pants/src/rust/engine/task_executor/src/lib.rs:184:7
  58: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/future/mod.rs:80:19
  59: <tokio::task::task_local::TaskLocalFuture<T,F> as core::future::future::Future>::poll::{{closure}}
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/task/task_local.rs:280:28
  60: tokio::task::task_local::TaskLocalFuture<T,F>::with_task
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/task/task_local.rs:272:9
  61: <tokio::task::task_local::TaskLocalFuture<T,F> as core::future::future::Future>::poll
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/task/task_local.rs:280:9
  62: stdio::scope_task_destination::{{closure}}
             at /Users/stuhood/src/pants/src/rust/engine/stdio/src/lib.rs:466:3
  63: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/future/mod.rs:80:19
  64: tokio::runtime::task::core::CoreStage<T>::poll::{{closure}}
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/runtime/task/core.rs:161:17
  65: tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/loom/std/unsafe_cell.rs:14:9
  66: tokio::runtime::task::core::CoreStage<T>::poll
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/runtime/task/core.rs:151:13
  67: tokio::runtime::task::harness::poll_future::{{closure}}
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/runtime/task/harness.rs:461:19
  68: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/panic/unwind_safe.rs:271:9
  69: std::panicking::try::do_call
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:406:40
  70: <unknown>
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:434:6
  71: std::panicking::try
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:370:19
  72: std::panic::catch_unwind
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panic.rs:133:14
  73: tokio::runtime::task::harness::poll_future
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/runtime/task/harness.rs:449:18
  74: tokio::runtime::task::harness::Harness<T,S>::poll_inner
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/runtime/task/harness.rs:98:27
  75: tokio::runtime::task::harness::Harness<T,S>::poll
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/runtime/task/harness.rs:53:15
  76: tokio::runtime::task::raw::poll
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/runtime/task/raw.rs:113:5
  77: tokio::runtime::task::raw::RawTask::poll
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/runtime/task/raw.rs:70:18
  78: tokio::runtime::task::LocalNotified<S>::run
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/runtime/task/mod.rs:343:9
  79: tokio::runtime::thread_pool::worker::Context::run_task::{{closure}}
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/runtime/thread_pool/worker.rs:448:21
  80: tokio::coop::with_budget::{{closure}}
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/coop.rs:102:9
  81: std::thread::local::LocalKey<T>::try_with
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/thread/local.rs:399:16
  82: std::thread::local::LocalKey<T>::with
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/thread/local.rs:375:9
  83: tokio::coop::with_budget
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/coop.rs:95:5
  84: tokio::coop::budget
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/coop.rs:72:5
  85: tokio::runtime::thread_pool::worker::Context::run_task
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/runtime/thread_pool/worker.rs:424:9
  86: tokio::runtime::thread_pool::worker::Context::run
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/runtime/thread_pool/worker.rs:391:24
  87: tokio::runtime::thread_pool::worker::run::{{closure}}
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/runtime/thread_pool/worker.rs:376:17
  88: tokio::macros::scoped_tls::ScopedKey<T>::set
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/macros/scoped_tls.rs:61:9
  89: tokio::runtime::thread_pool::worker::run
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/runtime/thread_pool/worker.rs:373:5
  90: tokio::runtime::thread_pool::worker::Launch::launch::{{closure}}
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/runtime/thread_pool/worker.rs:352:45
  91: <tokio::runtime::blocking::task::BlockingTask<T> as core::future::future::Future>::poll
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/runtime/blocking/task.rs:42:21
  92: tokio::runtime::task::core::CoreStage<T>::poll::{{closure}}
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/runtime/task/core.rs:161:17
  93: tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut
             at /Users/stuhood/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.16.1/src/loom/std/unsafe_cell.rs:14:9
  94: tokio::runtime::task::core::CoreStage<T>::poll

See pantsbuild/pants@main...stuhood:stuhood/dhat for the relevant diff enabling the tool.

Malloc error when loaded as a shared library in a Python interpreter

When loaded as a shared library (Python extension module built using PyO3) on macOS, dhat crashes with:

(98086,0x70000b425000) malloc: *** error for object 0x7f8c8b83bd20: pointer being realloc'd was not allocated
(98086,0x70000b425000) malloc: *** set a breakpoint in malloc_error_break to debug

A branch that reproduces this is here: pantsbuild/pants@main...stuhood:stuhood/dhat .. run MODE=debug ./pants help and then inspect .pants.d/pants.log to repro.

Remove stacks before main

My DHAT report spends a lot of room telling me about

  │       #11: 0x7ff64bc4584a: large_case::main (large_case.rs:19:0)
  │       #12: 0x7ff64bc53b06: core::ops::function::FnOnce::call_once (function.rs:227:0)
  │       #13: 0x7ff64bc53b06: std::sys_common::backtrace::__rust_begin_short_backtrace<fn(),tuple<>> (backtrace.rs:125:0)
  │       #14: 0x7ff64bc53b1c: std::rt::lang_start::{{closure}} (rt.rs:66:0)
  │       #15: 0x7ff64bc53b1c: core::ops::function::FnOnce::call_once (function.rs:227:0)
  │       #16: 0x7ff64bc53b1c: core::ops::function::FnOnce::call_once<closure-0,tuple<>> (rt.rs:66:0)
  │       #17: 0x7ff64bc7ad83: core::ops::function::impls::{{impl}}::call_once (function.rs:280:0)
  │       #18: 0x7ff64bc7ad83: std::panicking::try::do_call (panicking.rs:379:0)
  │       #19: 0x7ff64bc7ad83: std::panicking::try (panicking.rs:343:0)
  │       #20: 0x7ff64bc7ad83: std::panic::catch_unwind (panic.rs:396:0)
  │       #21: 0x7ff64bc7ad83: std::rt::lang_start_internal (rt.rs:51:0)
  │       #22: 0x7ff64bc45ed7: main (???:0:0)
  │       #23: 0x7ff64bc8af38: invoke_main (exe_common.inl:78:0)
  │       #24: 0x7ff64bc8af38: __scrt_common_main_seh (exe_common.inl:288:0)
  │       #25: 0x7ffcb1cf7034: BaseThreadInitThunk (???:0:0)
  │       #26: 0x7ffcb1f3cec1: RtlUserThreadStart (???:0:0)

This is the stack frame where I called start_heap_profiling. Can we get the backtrace for start_heap_profiling and skip that part of the json?

advise to use custom profile in crate docs

Hey, thanks for the great crate. I've been using it extensively for my project.

One thing I'd highlight in the doc is the use of a custom profile in the cargo manifest:

[profile.dhat] # for profiling only # dhat
inherits = "release"
debug = 1

As enabling debug for release builds otherwise increase the final binary size. This goes well with having a feature to enable dhat, and you can even add a cargo alias in project/.cargo/config.toml to get both running easily.

dhat = "run --profile dhat --features dhat --"

Since this is rather a style point I didn't make a PR but rather an issue

What is the expected overhead?

I am happily using this to make my code faster. Thank you!
The hardest part is making small enough examples to run in a handful of minutes. When I comment out the let _dhat = Dhat::start_heap_profiling(); it takes less then one second. Is this intended?
If this level of overhead is exemptible, can we document it?
If not, I will try to build a reproducible example.

compile error

   --> /home/xb/.cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd/dhat-0.2.1/src/lib.rs:483:40
    |
483 | ...                   symbol.colno().unwrap_or(0),
    |                              ^^^^^ method not found in `&BacktraceSymbol`

when compile dhat-rs directly there's no error, i can use 'cargo run --example heap' with out any error.
but when i add crate dhat in my project, it's turn out the up front error.
my os is ubuntu 16.04.

PoisonError encountered

After having run into #13 on MacOS, we ran dhat on Linux. For simple examples this seemed to work well. But once we tried a load test we managed to trigger a PoisonError:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "PoisonError { inner: .. }"', /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/dhat-0.2.2/src/lib.rs:247:70

We have no idea what is causing this error, but we were hoping that filing it might be helpful. Thanks!

System Details

  • OS: Linux (Not sure which flavor; but it's a recent install)
  • Rust version: 1.49

Source of Panic

The unwrap call on line 247 seems to be the root of the issue.

dhat-rs/src/lib.rs

Lines 244 to 248 in bfbd533

if_ignoring_allocs_else(
|| System.alloc(layout),
|| {
let tri: &mut Tri<Globals> = &mut TRI_GLOBALS.lock().unwrap();
let ptr = System.alloc(layout);

Stack Trace

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "PoisonError { inner: .. }"', /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/dhat-0.2.2/src/lib.rs:247:70
stack backtrace:
   0: rust_begin_unwind
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:495:5
   1: core::panicking::panic_fmt
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/core/src/panicking.rs:92:14
   2: core::option::expect_none_failed
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/core/src/option.rs:1268:5
   3: core::result::Result::unwrap
             at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/result.rs:973:23
   4: ::alloc::{{closure}}
             at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/dhat-0.2.2/src/lib.rs:247:51
   5: dhat::if_ignoring_allocs_else
             at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/dhat-0.2.2/src/lib.rs:620:9
   6: ::alloc
             at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/dhat-0.2.2/src/lib.rs:244:9
   7: __rg_alloc
             at /home/dom/Documents/Repositories/prisma-engines/query-engine/query-engine/src/main.rs:30:1
   8: alloc::alloc::alloc
             at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/alloc.rs:84:14
   9: alloc::alloc::Global::alloc_impl
             at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/alloc.rs:164:73
  10: ::alloc
             at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/alloc.rs:224:9
  11: alloc::raw_vec::finish_grow
             at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/raw_vec.rs:495:9
  12: alloc::raw_vec::RawVec::grow_amortized
             at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/raw_vec.rs:428:19
  13: alloc::raw_vec::RawVec::try_reserve
             at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/raw_vec.rs:317:13
  14: alloc::raw_vec::RawVec::reserve
             at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/raw_vec.rs:311:24
  15: alloc::vec::Vec::reserve
             at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec.rs:505:9
  16: alloc::vec::Vec::push
             at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec.rs:1210:13
  17: regex_syntax::ast::parse::ParserI

::parse_with_comments at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-syntax-0.6.22/src/ast/parse.rs:1007:22 18: regex_syntax::ast::parse::ParserI

::parse at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-syntax-0.6.22/src/ast/parse.rs:964:9 19: regex_syntax::ast::parse::Parser::parse at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-syntax-0.6.22/src/ast/parse.rs:338:9 20: regex_syntax::parser::Parser::parse at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-syntax-0.6.22/src/parser.rs:196:19 21: regex::exec::ExecBuilder::parse at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-1.4.3/src/exec.rs:242:17 22: regex::exec::ExecBuilder::build at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-1.4.3/src/exec.rs:307:22 23: regex::re_builder::unicode::RegexBuilder::build at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-1.4.3/src/re_builder.rs:70:21 24: regex::re_unicode::Regex::new at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-1.4.3/src/re_unicode.rs:176:9 25: <::from_str::DIRECTIVE_RE as core::ops::deref::Deref>::deref::__static_ref_initialize at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-subscriber-0.2.15/src/filter/env/directive.rs:179:46 26: core::ops::function::FnOnce::call_once at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5 27: lazy_static::lazy::Lazy::get::{{closure}} at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-1.4.0/src/inline_lazy.rs:31:29 28: std::sync::once::Once::call_once::{{closure}} at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sync/once.rs:261:41 29: std::sync::once::Once::call_inner at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/sync/once.rs:419:21 30: std::sync::once::Once::call_once at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sync/once.rs:261:9 31: lazy_static::lazy::Lazy::get at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-1.4.0/src/inline_lazy.rs:30:9 32: <::from_str::DIRECTIVE_RE as core::ops::deref::Deref>::deref::__stability at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-1.4.0/src/lib.rs:142:21 33: <::from_str::DIRECTIVE_RE as core::ops::deref::Deref>::deref at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-1.4.0/src/lib.rs:144:17 34: ::from_str at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-subscriber-0.2.15/src/filter/env/directive.rs:210:20 35: core::str::::parse at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/str/mod.rs:2209:9 36: tracing_subscriber::filter::env::EnvFilter::new::{{closure}} at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-subscriber-0.2.15/src/filter/env/mod.rs:156:72 37: core::ops::function::impls:: for &mut F>::call_mut at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:269:13 38: core::iter::traits::iterator::Iterator::find_map::check::{{closure}} at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:2257:32 39: core::iter::traits::iterator::Iterator::try_fold at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:1888:21 40: core::iter::traits::iterator::Iterator::find_map at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:2263:9 41: as core::iter::traits::iterator::Iterator>::next at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/mod.rs:1245:9 42: as alloc::vec::SpecFromIterNested>::from_iter at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec.rs:2082:32 43: as alloc::vec::SpecFromIter>::from_iter at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec.rs:2119:9 44: as core::iter::traits::collect::FromIterator>::from_iter at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec.rs:1959:9 45: core::iter::traits::iterator::Iterator::collect at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:1670:9 46: tracing_subscriber::filter::env::EnvFilter::from_directives at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-subscriber-0.2.15/src/filter/env/mod.rs:253:34 47: tracing_subscriber::filter::env::EnvFilter::new at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-subscriber-0.2.15/src/filter/env/mod.rs:163:9 48: core::ops::function::FnOnce::call_once at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5 49: core::result::Result::map at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/result.rs:508:25 50: tracing_subscriber::filter::env::EnvFilter::from_env at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-subscriber-0.2.15/src/filter/env/mod.rs:150:9 51: tracing_subscriber::filter::env::EnvFilter::from_default_env at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-subscriber-0.2.15/src/filter/env/mod.rs:144:9 52: query_engine::init_logger at /home/dom/Documents/Repositories/prisma-engines/query-engine/query-engine/src/main.rs:69:18 53: query_engine::main::main::{{closure}}::main::{{closure}} at /home/dom/Documents/Repositories/prisma-engines/query-engine/query-engine/src/main.rs:52:9 54: as core::future::future::Future>::poll at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19 55: query_engine::main::main::{{closure}} at /home/dom/Documents/Repositories/prisma-engines/query-engine/query-engine/src/main.rs:42:12 56: as core::future::future::Future>::poll at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19 57: query_engine::main::{{closure}} at /home/dom/Documents/Repositories/prisma-engines/query-engine/query-engine/src/main.rs:40:1 58: as core::future::future::Future>::poll at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19 59: as core::future::future::Future>::poll::{{closure}} at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/task/builder.rs:199:17 60: async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current::{{closure}} at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/task/task_locals_wrapper.rs:60:13 61: std::thread::local::LocalKey::try_with at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:272:16 62: std::thread::local::LocalKey::with at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:248:9 63: async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/task/task_locals_wrapper.rs:55:9 64: as core::future::future::Future>::poll at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/task/builder.rs:197:13 65: as core::future::future::Future>::poll at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-lite-1.11.3/src/future.rs:526:33 66: async_executor::Executor::run::{{closure}} at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-executor-1.4.0/src/lib.rs:236:9 67: as core::future::future::Future>::poll at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19 68: async_executor::LocalExecutor::run::{{closure}} at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-executor-1.4.0/src/lib.rs:437:9 69: as core::future::future::Future>::poll at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19 70: async_io::driver::block_on at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-io-1.3.1/src/driver.rs:142:33 71: async_global_executor::reactor::block_on::{{closure}} at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-global-executor-2.0.2/src/reactor.rs:3:18 72: tokio::runtime::context::enter at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.24/src/runtime/context.rs:72:5 73: tokio::runtime::handle::Handle::enter at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.24/src/runtime/handle.rs:76:9 74: async_global_executor::tokio02::enter at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-global-executor-2.0.2/src/tokio02.rs:5:5 75: async_global_executor::reactor::block_on::{{closure}} at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-global-executor-2.0.2/src/reactor.rs:9:18 76: async_global_executor::reactor::block_on at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-global-executor-2.0.2/src/reactor.rs:12:5 77: async_global_executor::executor::block_on::{{closure}} at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-global-executor-2.0.2/src/executor.rs:26:36 78: std::thread::local::LocalKey::try_with at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:272:16 79: std::thread::local::LocalKey::with at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:248:9 80: async_global_executor::executor::block_on at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-global-executor-2.0.2/src/executor.rs:26:5 81: async_std::task::builder::Builder::blocking::{{closure}}::{{closure}} at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/task/builder.rs:171:25 82: async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current::{{closure}} at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/task/task_locals_wrapper.rs:60:13 83: std::thread::local::LocalKey::try_with at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:272:16 84: std::thread::local::LocalKey::with at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:248:9 85: async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/task/task_locals_wrapper.rs:55:9 86: async_std::task::builder::Builder::blocking::{{closure}} at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/task/builder.rs:168:17 87: std::thread::local::LocalKey::try_with at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:272:16 88: std::thread::local::LocalKey::with at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:248:9 89: async_std::task::builder::Builder::blocking at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/task/builder.rs:161:9 90: async_std::task::block_on::block_on at /home/dom/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/task/block_on.rs:33:5 91: query_engine::main at /home/dom/Documents/Repositories/prisma-engines/query-engine/query-engine/src/main.rs:40:1 92: core::ops::function::FnOnce::call_once at /home/dom/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5 note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.