Skip to content

pprof panic on recent toolchains #174

Closed
@korniltsev

Description

@korniltsev

This simple program panics on recent toolchains

use pyroscope::PyroscopeAgent;
use pyroscope_pprofrs::{pprof_backend, PprofConfig};

fn main() {
    let pprof_config = PprofConfig::new().sample_rate(100);
    let pprof_backend = pprof_backend(pprof_config);

    let pprof_agent =
        PyroscopeAgent::builder("https://asd.net", "qwe")
            .basic_auth("xxx", "xxxx")
            .backend(pprof_backend)
            .build().unwrap();

    let running_agent = pprof_agent.start().unwrap();

    let (add_tag, _) = running_agent.tag_wrapper();

    let _ = add_tag("connections".to_string(), 10.to_string());
    let _ = add_tag("watchers".to_string(), 10.to_string());

    running_agent.stop().unwrap().shutdown();
}

panic:

/home/korniltsev/.cargo/bin/cargo run --color=always --package pg --bin pg
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.06s
     Running `target/debug/pg`
thread 'main' panicked at library/core/src/panicking.rs:221:5:
unsafe precondition(s) violated: slice::from_raw_parts requires the pointer to be aligned and non-null, and the total size of the slice not to exceed `isize::MAX`
stack backtrace:
   0: rust_begin_unwind
             at /rustc/6292b2af620dbd771ebb687c3a93c69ba8f97268/library/std/src/panicking.rs:661:5
   1: core::panicking::panic_nounwind_fmt::runtime
             at /rustc/6292b2af620dbd771ebb687c3a93c69ba8f97268/library/core/src/panicking.rs:112:18
   2: core::panicking::panic_nounwind_fmt
             at /rustc/6292b2af620dbd771ebb687c3a93c69ba8f97268/library/core/src/panicking.rs:122:5
   3: core::panicking::panic_nounwind
             at /rustc/6292b2af620dbd771ebb687c3a93c69ba8f97268/library/core/src/panicking.rs:221:5
   4: core::slice::raw::from_raw_parts::precondition_check
             at /rustc/6292b2af620dbd771ebb687c3a93c69ba8f97268/library/core/src/ub_checks.rs:68:21
   5: core::slice::raw::from_raw_parts
             at /rustc/6292b2af620dbd771ebb687c3a93c69ba8f97268/library/core/src/ub_checks.rs:75:17
   6: <pprof::collector::TempFdArrayIterator<T> as core::iter::traits::iterator::Iterator>::next
             at /home/korniltsev/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pprof-0.12.1/src/collector.rs:225:26
   7: core::iter::traits::iterator::Iterator::fold
             at /rustc/6292b2af620dbd771ebb687c3a93c69ba8f97268/library/core/src/iter/traits/iterator.rs:2587:29
   8: <core::iter::adapters::chain::Chain<A,B> as core::iter::traits::iterator::Iterator>::fold
             at /rustc/6292b2af620dbd771ebb687c3a93c69ba8f97268/library/core/src/iter/adapters/chain.rs:126:19
   9: core::iter::traits::iterator::Iterator::for_each
             at /rustc/6292b2af620dbd771ebb687c3a93c69ba8f97268/library/core/src/iter/traits/iterator.rs:818:9
  10: pprof::report::ReportBuilder::build
             at /home/korniltsev/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pprof-0.12.1/src/report.rs:110:17
  11: pyroscope_pprofrs::Pprof::dump_report
             at /home/korniltsev/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyroscope_pprofrs-0.2.7/src/lib.rs:202:22
  12: <pyroscope_pprofrs::Pprof as pyroscope::backend::backend::Backend>::add_rule
             at /home/korniltsev/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyroscope_pprofrs-0.2.7/src/lib.rs:180:13
  13: pyroscope::pyroscope::PyroscopeAgent<pyroscope::pyroscope::PyroscopeAgentRunning>::tag_wrapper::{{closure}}
             at /home/korniltsev/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyroscope-0.5.7/src/pyroscope.rs:776:17
  14: pg::main
             at ./src/main.rs:18:13
  15: core::ops::function::FnOnce::call_once
             at /rustc/6292b2af620dbd771ebb687c3a93c69ba8f97268/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread caused non-unwinding panic. aborting.

Process finished with exit code 134 (interrupted by signal 6:SIGABRT)









Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions