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

SIGSEGV running safe code #10

Open
AlisdairO opened this issue Feb 21, 2016 · 0 comments
Open

SIGSEGV running safe code #10

AlisdairO opened this issue Feb 21, 2016 · 0 comments

Comments

@AlisdairO
Copy link

While messing around with the benchmarks today I ran into the following:

test pool_individual ... thread '<unnamed>' panicked at 'thread 'bad number of channels left 0<unnamed>', ' panicked at '../src/libstd/sync/mpsc/shared.rsbad number of channels left -2:', ../src/libstd/sync/mpsc/shared.rs:346346

stack backtrace:
thread '<unnamed>' panicked at 'bad number of channels left -1', ../src/libstd/sync/mpsc/shared.rs:346
thread '<unnamed>' panicked at 'bad number of channels left -3', ../src/libstd/sync/mpsc/shared.rs:346
   1:        0x1018cf408 - sys::backtrace::tracing::imp::write::hd2c80f5e6164b288Sju
   2:        0x1018d0ec5 - panicking::default_handler::_$u7b$$u7b$closure$u7d$$u7d$::closure.42908
   3:        0x1018d0ae8 - panicking::default_handler::h36a516d1790b538eZDy
   4:        0x1018c6136 - sys_common::unwind::begin_unwind_inner::h6bef346cfa00530fajt
   5:        0x1018c65ae - sys_common::unwind::begin_unwind_fmt::hd46a8bf3b027ae6agit
   6:        0x10185eb76 - std..sync..mpsc..Sender<bool>::drop.6710::hc9f776eb327502e7
   7:        0x10186a45d - simple_parallel::pool::Pool::unordered_map::thread '_<unnamed>$u7b$$u7b$closure$u7d$$u7d$' panicked at '::bad number of channels left 0_', $u7b$$u7b$closure$u7d$$u7d$../src/libstd/sync/mpsc/shared.rs:::closure.7131346

   8:        0x1018c1030 - sys_common::unwind::try::try_fn::h11016301218827575359
thread '<unnamed>' panicked at 'called 'Option::unwrap()' on a 'None' value', ../src/libcore/option.rs:330  
 9:    thread ' <unnamed> ' panicked at ' bad number of channels left 0 ', 0x../src/libstd/sync/mpsc/shared.rs1018ce83b: - 346__rust_try

  10:        0x1018cc513 - sys_commonthread '::<unnamed>unwind' panicked at '::called 'Option::unwrap()' on a 'None' valueinner_try', ::../src/libcore/option.rsh0d91b1e766cf5ae7cgt:
330
  thread '11<unnamed>: ' panicked at ' bad number of channels left 0 ',  ../src/libstd/sync/mpsc/shared.rs : 346 
 0x1018c2117 - boxed::F.FnBox<A>::call_box::h9811097413934130002
  12:       thread ' <unnamed>0x' panicked at '1018d014f - sys::thread::Thread::new::thread_startbad number of channels left -1::h964aafa589ae520eqSx
', ../src/libstd/sync/mpsc/shared.rs:  34613
:     0x7fff91057898 - _pthread_body
  14:     0x7fff91057729 - _pthread_start
stack backtrace:
   1:        0x1018cf408 - sys::backtrace::tracing::imp::write::hd2c80f5e6164b288Sju
   2:        0x1018d0ec5 - panicking::default_handler::_$u7b$$u7b$closure$u7d$$u7d$::closure.42908
   3:        0x1018d0ae8 - panicking::default_handler::h36a516d1790b538eZDy
   4:        0x1018c6136 - sys_common::unwind::begin_unwind_inner::h6bef346cfa00530fajt
   5:        0x1018c65ae - sys_common::unwind::begin_unwind_fmt::hd46a8bf3b027ae6agit
   6:        0x10185eb76 - std..sync..mpsc..Sender<bool>::drop.6710::hc9f776eb327502e7
   7:        0x10186a45d - simple_parallel::pool::Pool::unordered_map::_$u7b$$u7b$closure$u7d$$u7d$::_$u7b$$u7b$closure$u7d$$u7d$::closure.7131
   8:   thread ' <unnamed> ' panicked at ' bad number of channels left -1 ',  ../src/libstd/sync/mpsc/shared.rs0x:1018c1030346 - 
sys_common::unwind::try::try_fn::h11016301218827575359
   9:        0x1018ce83bthread ' - <unnamed>__rust_try' panicked at '
bad number of channels left 0', ../src/libstd/sync/mpsc/shared.rs:346
  10:        0x1018cc513 - thread 'sys_common<unnamed>::' panicked at 'unwindbad number of channels left -4::', inner_try../src/libstd/sync/mpsc/shared.rs:::h0d91b1e766cf5ae7cgt346

  11:      thread '  <unnamed>0x' panicked at '1018c2117bad number of channels left -2 - ', ../src/libstd/sync/mpsc/shared.rsboxed:::346F.FnBox
<A>::call_box::h9811097413934130002
  12:  thread ' <unnamed> ' panicked at ' bad number of channels left -6 ',  ../src/libstd/sync/mpsc/shared.rs :0x3461018d014f
 - sys::thread::Thread::new::thread_start::h964aafa589ae520eqSx
thread '  <unnamed>13' panicked at ': bad number of channels left -5 ',  ../src/libstd/sync/mpsc/shared.rs : 3460x
7fff91057898 - _pthread_body
  14:     0x7fff91057729 - _pthread_start
thread '<unnamed>' panicked at 'bad number of channels left -3', ../src/libstd/sync/mpsc/shared.rs:346
stack backtrace:
   1:        0x1018cf408 - sys::backtrace::tracing::imp::write::hd2c80f5e6164b288Sju
   2:        0x1018d0ec5 - panicking::default_handler::_$u7b$$u7b$closure$u7d$$u7d$::closure.42908
   3:        0x1018d0ae8 - panicking::default_handler::h36a516d1790b538eZDy
   4:        0x1018c6136 - sys_common::unwind::begin_unwind_inner::h6bef346cfa00530fajt
   5:        0x1018c65ae - sys_common::unwind::begin_unwind_fmt::hd46a8bf3b027ae6agit
   6:        0x10185eb76 - std..sync..mpsc..Sender<bool>::drop.6710::hc9f776eb327502e7
   7:        0x10186a45d - simple_parallel::pool::Pool::unordered_map::_$u7b$$u7b$closure$u7d$$u7d$::_$u7b$$u7b$closure$u7d$$u7d$::closure.7131
   8:        0x1018c1030 - sys_common::unwind::try::try_fn::h11016301218827575359
   9:        0x1018ce83b - __rust_try
  10:        0x1018cc513 - sys_common::unwind::inner_try::h0d91b1e766cf5ae7cgt
  11:        0x1018c2117 - boxed::F.FnBox<A>::call_box::h9811097413934130002
  12:        0x1018d014f - sys::thread::Thread::new::thread_start::h964aafa589ae520eqSx
  13: thread ' <unnamed> ' panicked at ' called 'Option::unwrap()' on a 'None' value ', 0x7fff91057898../src/libcore/option.rs - :_pthread_body330

Process didn't exit successfully: '/Users/alisdair/coding/rust/simple_parallel/target/release/transform-151cdb951485d908 --bench' (signal: 11, SIGSEGV: invalid memory reference)

This/similar errors are repeatable on my machine using the following code:

fn run<F>(b: &mut test::Bencher, mut f: F) where F: FnMut(&[&[i32]]) -> i32 {
    let v = vec![0; 10];
    let w = vec![&*v; 50];
    b.iter(|| {
        f(test::black_box(&w))
    })  
}

fn sum<I: Iterator<Item = i32>>(iter: I) -> i32 {
    //iter.fold(0, |a, b| a + b)
    0   
}

#[bench]
fn pool_individual(b: &mut test::Bencher) {
    let mut pool = simple_parallel::Pool::new(num_cpus::get());
    run(b, |w| {
        crossbeam::scope(|scope| {
            sum(pool.unordered_map(scope, w, |v: &&[i32]| sum(v.iter().cloned())).map(|(_,t)| t)) 
        })  
    })  
}
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