Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SIGTRAP from max slice size exceeded #252

Open
ealui-statsig opened this issue Sep 13, 2024 · 0 comments
Open

SIGTRAP from max slice size exceeded #252

ealui-statsig opened this issue Sep 13, 2024 · 0 comments

Comments

@ealui-statsig
Copy link

When generating a report from the profile, its possible for max slice size to be hit (exit code 133). This causes the following stack trace:

{
  "v": 0,
  "msg": "panicked at library/core/src/panicking.rs:221:5:\nunsafe 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`",
  "level": 50,
  "pod_name": "MacBook-Pro-7.local",
  "pid": 12868,
  "time": "2024-09-13T19:20:09.75422Z",
  "target": "logging_lib",
  "line": 8,
  "file": "rust_libs/logging-lib/src/lib.rs",
  "error.stack": [
    {
      "0": "backtrace::backtrace::libunwind::trace",
      "location": "/Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/backtrace-0.3.73/src/backtrace/libunwind.rs:116:5"
    },
    {
      "1": "backtrace::backtrace::trace_unsynchronized",
      "location": "/Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/backtrace-0.3.73/src/backtrace/mod.rs:66:5"
    },
    {
      "2": "backtrace::backtrace::trace",
      "location": "/Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/backtrace-0.3.73/src/backtrace/mod.rs:53:14"
    },
    {
      "3": "backtrace::capture::Backtrace::create",
      "location": "/Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/backtrace-0.3.73/src/capture.rs:197:9"
    },
    {
      "4": "backtrace::capture::Backtrace::new",
      "location": "/Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/backtrace-0.3.73/src/capture.rs:162:22"
    },
    {
      "5": "logging_lib::panic_hook",
      "location": "/Users/user/Documents/GitHub/statsig/rust_libs/logging-lib/src/lib.rs:11:39"
    },
    {
      "6": "core::ops::function::Fn::call",
      "location": "/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/ops/function.rs:79:5"
    },
    {
      "7": "<alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call",
      "location": "/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/boxed.rs:2084:9"
    },
    {
      "8": "std::panicking::rust_panic_with_hook",
      "location": "/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:808:13"
    },
    {
      "9": "std::panicking::begin_panic_handler::{{closure}}",
      "location": "/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:667:13"
    },
    {
      "10": "std::sys::backtrace::__rust_end_short_backtrace",
      "location": "/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/sys/backtrace.rs:168:18"
    },
    {
      "11": "rust_begin_unwind",
      "location": "/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:665:5"
    },
    {
      "12": "core::panicking::panic_nounwind_fmt::runtime",
      "location": "/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panicking.rs:112:18"
    },
    {
      "13": "core::panicking::panic_nounwind_fmt",
      "location": "/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panicking.rs:122:5"
    },
    {
      "14": "core::panicking::panic_nounwind",
      "location": "/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panicking.rs:221:5"
    },
    {
      "15": "core::slice::raw::from_raw_parts::precondition_check",
      "location": "/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/ub_checks.rs:68:21"
    },
    {
      "16": "core::slice::raw::from_raw_parts",
      "location": "/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/ub_checks.rs:75:17"
    },
    {
      "17": "<pprof::collector::TempFdArrayIterator<T> as core::iter::traits::iterator::Iterator>::next",
      "location": "/Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pprof-0.13.0/src/collector.rs:225:26"
    },
    {
      "18": "core::iter::traits::iterator::Iterator::fold",
      "location": "/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/iter/traits/iterator.rs:2587:29"
    },
    {
      "19": "<core::iter::adapters::chain::Chain<A,B> as core::iter::traits::iterator::Iterator>::fold",
      "location": "/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/iter/adapters/chain.rs:126:19"
    },
    {
      "20": "core::iter::traits::iterator::Iterator::for_each",
      "location": "/rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/iter/traits/iterator.rs:818:9"
    },
    {
      "21": "pprof::report::ReportBuilder::build",
      "location": "/Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pprof-0.13.0/src/report.rs:110:17"
    },
    ...
    ...
    ...
    ...
    ...
  ]
}

This is triggered from simply doing something like this:

pub async fn do_profile(profiling_duration_s: u64) -> Result<Report, Error> {
        let guard = pprof::ProfilerGuard::new(1000)?;
        tokio::time::sleep(std::time::Duration::new(profiling_duration_s, 0)).await;
        guard.report().build()
    }

In my test, profiling_duration_s was 10s, but I think its highly dependent on the contents of the profile itself

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant