anp / cue

Simple parallel pipeline for long tasks in Rust.
MIT License
17 stars 2 forks source link

Crossbeam panic #4

Open fellmk opened 6 years ago

fellmk commented 6 years ago

The version of crossbeam used here can lead to a difficult to replicate segfault. The reason is documented on the crossbeam git repository (https://github.com/crossbeam-rs/crossbeam/issues/107). Updating to the latest version of crossbeam (0.3.2) appears to solve the issue. If you are interested in the backtrace:

RUST_BACKTRACE=1 cargo run --bin mtsv-signature -- -t 24 -x mkftests/tree.index --input mkftests/test.clp --lca 0 --output mkftests/testmkf.sig
    Finished dev [unoptimized + debuginfo] target(s) in 0.17s
     Running `target/debug/mtsv-signature -t 24 -x mkftests/tree.index --input mkftests/test.clp --lca 0 --output mkftests/testmkf.sig`
[INFO 2018-07-12 11:36:13.517 mtsv_signature] Opening files...
[INFO 2018-07-12 11:36:13.570 mtsv_signature] Deserializing taxonomic index...
[INFO 2018-07-12 11:36:50.719 mtsv_signature] Finding informative reads...
thread '<unnamed>' panicked at 'inconsistent state in unpark', libstd/thread/mod.rs:1058:22
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::unix::backtrace::tracing::'imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at libstd/sys_common/backtrace.rs:71
             at libstd/sys_common/backtrace.rs:59
   2: std::panicking::default_hook::{{closure}}
             at libstd/panicking.rs:211
   3: std::panicking::default_hook
             at libstd/panicking.rs:227
   4: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:463
   5: std::panicking::begin_panic
             at libstd/panicking.rs:397
   6: std::thread::Thread::unpark
             at libstd/thread/mod.rs:1058
   7: <crossbeam::sync::ms_queue::MsQueue<T>>::push
             at /home/mkf58/.cargo/registry/src/github.com-1ecc6299db9ec823/crossbeam-0.2.12/src/sync/ms_queue.rs:178
   8: cue::pipeline::{{closure}}::{{closure}}
             at /home/mkf58/.cargo/registry/src/github.com-1ecc6299db9ec823/cue-0.1.0/src/lib.rs:89
   9: crossbeam::scoped::Scope::spawn::{{closure}}
             at /home/mkf58/.cargo/registry/src/github.com-1ecc6299db9ec823/crossbeam-0.2.12/src/scoped.rs:237
  10: <F as crossbeam::FnBox>::call_box
             at /home/mkf58/.cargo/registry/src/github.com-1ecc6299db9ec823/crossbeam-0.2.12/src/lib.rs:44
  11: crossbeam::spawn_unsafe::{{closure}}
             at /home/mkf58/.cargo/registry/src/github.com-1ecc6299db9ec823/crossbeam-0.2.12/src/lib.rs:53

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Any', libcore/result.rs:945:5
stack backtrace:
   0: std::sys::unix::backtrace::tracing::'imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at libstd/sys_common/backtrace.rs:71
             at libstd/sys_common/backtrace.rs:59
   2: std::panicking::default_hook::{{closure}}
             at libstd/panicking.rs:211
   3: std::panicking::default_hook
             at libstd/panicking.rs:227
   4: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:463
   5: std::panicking::begin_panic_fmt
             at libstd/panicking.rs:350
   6: rust_begin_unwind
             at libstd/panicking.rs:328
   7: core::panicking::panic_fmt
             at libcore/panicking.rs:71
   8: core::result::unwrap_failed
             at /checkout/src/libcore/macros.rs:26
   9: <core::result::Result<T, E>>::unwrap
             at /checkout/src/libcore/result.rs:782
  10: crossbeam::scoped::JoinState::join
             at /home/mkf58/.cargo/registry/src/github.com-1ecc6299db9ec823/crossbeam-0.2.12/src/scoped.rs:33
  11: crossbeam::scoped::Scope::spawn::{{closure}}
             at /home/mkf58/.cargo/registry/src/github.com-1ecc6299db9ec823/crossbeam-0.2.12/src/scoped.rs:247
  12: <F as crossbeam::FnBox>::call_box
             at /home/mkf58/.cargo/registry/src/github.com-1ecc6299db9ec823/crossbeam-0.2.12/src/lib.rs:44
  13: crossbeam::scoped::Scope::drop_all
             at /home/mkf58/.cargo/registry/src/github.com-1ecc6299db9ec823/crossbeam-0.2.12/src/scoped.rs:98
  14: crossbeam::scoped::scope
             at /home/mkf58/.cargo/registry/src/github.com-1ecc6299db9ec823/crossbeam-0.2.12/src/scoped.rs:63
  15: cue::pipeline
             at /home/mkf58/.cargo/registry/src/github.com-1ecc6299db9ec823/cue-0.1.0/src/lib.rs:59
  16: mtsv::tax_tree::TreeWithIndices::find_and_write_informatives
             at ./src/tax_tree.rs:88
  17: mtsv_signature::main
             at src/bin/mtsv-signature.rs:120
  18: std::rt::lang_start::{{closure}}
             at /checkout/src/libstd/rt.rs:74
  19: std::panicking::try::do_call
             at libstd/rt.rs:59
             at libstd/panicking.rs:310
  20: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:105
  21: std::rt::lang_start_internal
             at libstd/panicking.rs:289
             at libstd/panic.rs:374
             at libstd/rt.rs:58
  22: std::rt::lang_start
             at /checkout/src/libstd/rt.rs:74
  23: main
  24: __libc_start_main
  25: _start
anp commented 6 years ago

Hey Mike! It's been a while!

Looks like this is technically a panic, not a segfault, since a segfault would print something like exited due to signal 11 (SIGSEGV, core dumped) or similar. So I'm not sure if the specific crossbeam issue you linked is a likely culprit here, but I definitely believe that upgrading crossbeam fixes the issue. There's been a ton of work on the library since I wrote cue.

I'd be happy to merge a PR bumping the crossbeam version, but I'll need to rename the crate as I transferred the crates.io name to someone else (see https://github.com/anp/cue/issues/3#issuecomment-394437348 for details) since the crate has only had one or two users aside from NAU and I haven't been working on it. So once that's done you'll have to rename it in Cargo.toml and lib.rs etc., but that shouldn't be too bad I think.

If it's easier for you, the code here is quite small and you could easily copy/paste it into your project and make the update there if you prefer.

fellmk commented 6 years ago

Hi Adam,

I had already pasted the code into the project and updated its dependencies when I posted. I just wanted to make sure you were aware of the issue since I saw one other person post an issue recently.

The original error did indicate SIGSEGV: Thread 22 "mtsv-signature" received signal SIGSEGV, Segmentation fault.

I didn’t know I could use Cargo to get backtraces until recently. Working on your code has motivated me to start learning Rust and in the process I found out how to get the trace I posted. Now I wish I had started learning Rust when you told me about it a few years ago.

Hopefully everything is going well in California. I visited San Francisco and the surrounding area recently and it looks like a nice place to live.

-Mike


Michael Fell App Sys Analyst/Prog -Intrmed Information Technology Services/SICCS Northern Arizona University Flagstaff, AZ 86011

From: Adam Perry notifications@github.com Sent: Thursday, July 19, 2018 11:57 AM To: anp/cue cue@noreply.github.com Cc: Michael Kenneth Fell Michael.Fell@nau.edu; Author author@noreply.github.com Subject: Re: [anp/cue] Crossbeam panic (#4)

Hey Mike! It's been a while!

Looks like this is technically a panic, not a segfault, since a segfault would print something like exited due to signal 11 (SIGSEGV, core dumped) or similar. So I'm not sure if the specific crossbeam issue you linked is a likely culprit here, but I definitely believe that upgrading crossbeam fixes the issue. There's been a ton of work on the library since I wrote cue.

I'd be happy to merge a PR bumping the crossbeam version, but I'll need to rename the crate as I transferred the crates.io name to someone else (see #3 (comment)https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fanp%2Fcue%2Fissues%2F3%23issuecomment-394437348&data=02%7C01%7Cmichael.fell%40nau.edu%7C6f30a65473c44725c92208d5eda97035%7C27d49e9f89e14aa099a3d35b57b2ba03%7C0%7C0%7C636676234349656660&sdata=X0UjmOUBNY7nHtP23KUCqyw6OkC%2F13w%2BwZYbvHKxUio%3D&reserved=0 for details) since the crate has only had one or two users aside from NAU and I haven't been working on it. So once that's done you'll have to rename it in Cargo.toml and lib.rs etc., but that shouldn't be too bad I think.

If it's easier for you, the code here is quite small and you could easily copy/paste it into your project and make the update there if you prefer.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fanp%2Fcue%2Fissues%2F4%23issuecomment-406379828&data=02%7C01%7Cmichael.fell%40nau.edu%7C6f30a65473c44725c92208d5eda97035%7C27d49e9f89e14aa099a3d35b57b2ba03%7C0%7C0%7C636676234349656660&sdata=FGFw5HdmiPRI3GvDX9rAqRl%2BdBkkUCIJ2qTpFraR3io%3D&reserved=0, or mute the threadhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAIZq2CzBHobRIsoEBXD1JaJhcHhnmsblks5uINaHgaJpZM4VTstt&data=02%7C01%7Cmichael.fell%40nau.edu%7C6f30a65473c44725c92208d5eda97035%7C27d49e9f89e14aa099a3d35b57b2ba03%7C0%7C0%7C636676234349656660&sdata=%2FejaymjF0VayCv5ocMPKwoWlM6FkKsjbqDbJFvT03Ho%3D&reserved=0.

anp commented 6 years ago

Oh, awesome! Glad to know you're unblocked. Thank you so much for the heads up!

anp commented 6 years ago

And yeah, things are going really well in CA! Hope things are great in the lab!