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 With Criterion and Flamegraph Features #237

Open
ShiromMakkad opened this issue Dec 5, 2023 · 13 comments
Open

SIGTRAP With Criterion and Flamegraph Features #237

ShiromMakkad opened this issue Dec 5, 2023 · 13 comments
Assignees

Comments

@ShiromMakkad
Copy link

ShiromMakkad commented Dec 5, 2023

I found this crate from this article: https://www.jibbow.com/posts/criterion-flamegraphs/, which it seems you've implemented as the criterion feature flag. I've found a bug and tested it on both the example code from the article and the criterion feature flag and I'm getting the same issue.

Here's the error:

Benchmarking is_authorized/10: Profiling for 5.0000 serror: bench failed, to rerun pass `--bench is_authorized`

Caused by:
  process didn't exit successfully: `/Users/smakkad/local workplace/local_agent/cedar-local-agent/target/release/deps/is_authorized-0aa3e8a693af2a5a --profile-time 5 --bench` (signal: 5, SIGTRAP: trace/breakpoint trap)

And my code:

const NUM_POLICIES_ARR: [u32; 3] = [10, 100, 1000];

fn is_authorized_benchmark(c: &mut Criterion) {
    let mut bench_group = c.benchmark_group("is_authorized");
    for i in NUM_POLICIES_ARR.iter() {
        let authorizer: Authorizer<PolicySetProvider, EntityProvider> = construct_authorizer(*i);
        let request = construct_request();
        validate_request(&authorizer, &request);

        let input = (request, Entities::empty());
        bench_group.bench_with_input(BenchmarkId::from_parameter(i), &input, |b, i| {
            let (request, entities) = i;
            b.to_async(tokio::runtime::Runtime::new().unwrap())
                .iter(|| async { authorizer.is_authorized(request, entities).await.unwrap() })
        });
    }
}

criterion_group!{
    name = benches;
    config = Criterion::default().with_profiler(PProfProfiler::new(100, Output::Flamegraph(None)));
    targets = is_authorized_benchmark
}
criterion_main!(benches);

I am running with --profile-time 5.

@ShiromMakkad
Copy link
Author

ShiromMakkad commented Dec 5, 2023

I also get a sigtrap if the frequency is set too high even without criterion integration

@YangKeao YangKeao self-assigned this Dec 6, 2023
@ShiromMakkad
Copy link
Author

@tjade273
Copy link

tjade273 commented Feb 10, 2024

I'm getting a SIGTRAP in similar circumstances, with every frequency value

@tareknaser
Copy link

Did you guys find a way around this?

@ShiromMakkad
Copy link
Author

I use this: https://github.com/flamegraph-rs/flamegraph. It doesn't have a high sampling frequency though. Wasn't able to resolve that issue.

@tareknaser
Copy link

Did you set it up with criterion?

@ShiromMakkad
Copy link
Author

There's a CLI arg that you can use to run a criterion benchmark. I used that.

@tareknaser
Copy link

yes got it. thanks!

@flyingsilverfin
Copy link

I'm also seeing this, particularly on ARM mac machines - a linux VM seems be run fine.

@ShiromMakkad
Copy link
Author

I tested this on an M1 Mac pro, so that could be it.

@systemsoverload
Copy link

+1 same issue on M1 mac here

@guergabo
Copy link

guergabo commented Jul 2, 2024

+1 same issue on M1 mac here, but it only happens when I use Mutex.

@ealui-statsig
Copy link

After upgrading to the latest rust version (1.81.0), I managed to get a stack trace for a SIGTRAP. Not sure if its related to this issue, but I filed a new one here: #252

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

8 participants