- 
                Notifications
    You must be signed in to change notification settings 
- Fork 31
Open
Description
Description
quantile_mut can fail with the error message:
thread 'main' has overflowed its stack
fatal runtime error: stack overflow
Version Information
- ndarray: 0.15.4
- ndarray-stats: 0.5.0
- Rust: 1.58.1
To Reproduce
use ndarray::Array1;
use ndarray_stats::{interpolate::Linear, Quantile1dExt};
use noisy_float::types::{n64, N64};
fn main() {
    {
        let mut array: Array1<N64> = Array1::ones(15300);
        println!("One {}", array.quantile_mut(n64(0.5), &Linear).unwrap());
    }
    {
        let mut array: Array1<N64> = Array1::ones(15600);
        println!("Two {}", array.quantile_mut(n64(0.5), &Linear).unwrap());
    }
    {
        let mut array: Array1<N64> = Array1::ones(100000);
        println!("Three {}", array.quantile_mut(n64(0.5), &Linear).unwrap());
    }
}Observed behavior
$ cargo run --profile=dev
One 1
thread 'main' has overflowed its stack
fatal runtime error: stack overflow
$ cargo run --profile=release
One 1
Two 1
thread 'main' has overflowed its stack
fatal runtime error: stack overflowExpected behavior
One 1
Two 1
Three 1
Additional context
- I'm able to reproduce this issue on both Linux and macOS with the default stack limit of 8 MiB. (ulimit -sreports 8192)
- The result is non-deterministic. Re-running the executable can succeed sometimes and fail sometimes. The larger the vector the more likely it is to fail.
- The result depends on whether optimization is enabled.
mcost45
Metadata
Metadata
Assignees
Labels
No labels