mimblewimble / grin

Minimal implementation of the Mimblewimble protocol.
https://grin.mw/
Apache License 2.0
5.04k stars 990 forks source link

[Server] thread 'main' panicked at 'already borrowed: BorrowMutError' #374

Closed AsrielBelacqua closed 6 years ago

AsrielBelacqua commented 6 years ago

~This looks similar to #305~ (Actually, having looked at both traces, it seems that two two unwraps occur at different code locations), though I haven't previously seen the main thread panic like this: there was a first panic 'called Option::unwrap() on a None value', but then a second panic 'already borrowed: BorrowMutError'. See log extract (and attached full log) below:

Nov 22 23:35:08.539 DEBG Saving newly connected peer 51.15.219.12:13414.  
Nov 22 23:35:08.540 DEBG saving peer to store PeerData { addr: V4(51.15.219.12:13414), capabilities: FULL_HIST | UTXO_HIST | PEER_LIST | FULL_NODE, user_agent: "MW/Grin 0.1", flags: Healthy }  
Nov 22 23:35:08.544 DEBG Asking 51.15.219.12:13414 for more peers.  
Nov 22 23:35:08.545 DEBG handshake connect with nonce - 2425148272027938797, sender - V4(0.0.0.0:13414), receiver - V4(185.8.164.22:13414)  
Nov 22 23:35:08.557 DEBG Received 17 peer addrs, saving.  
thread 'syncer' panicked at 'called `Option::unwrap()` on a `None` value', /checkout/src/libcore/option.rs:335:20  
Nov 22 23:stack backtrace:  
35:08.581 INFO Connected to peer PeerInfo { capabilities: FULL_HIST | UTXO_HIST | PEER_LIST | FULL_NODE, user_agent: "MW/Grin 0.1", version: 1, addr: V4(94.130.66.48:13414), total_difficulty: Difficulty { num: 27187535 } }  
Nov 22 23:35:08.581 DEBG Saving newly connected peer 94.130.66.48:13414.  
Nov 22 23:35:08.582 DEBG saving peer to store PeerData { addr: V4(94.130.66.48:13414), capabilities: FULL_HIST | UTXO_HIST | PEER_LIST | FULL_NODE, user_agent: "MW/Grin 0.1", flags: Healthy }  
Nov 22 23:35:08.582 DEBG Sync: Asking peer 91.134.132.74:13414 for more block headers, locator: [8ac1572d, a0315569, a56300a2, 71f994fd, ddb70412, 3cabe32a, 948c6ba5, 6d593a8f, 156025cc, e9c70fc5, e17ea64f]  
Nov 22 23:35:08.582 DEBG Sync: Retry 1 on block dac46274  
Nov 22 23:35:08.583 DEBG Requesting block dac46274 from peer 51.15.86.81:13414.  
Nov 22 23:35:08.583 DEBG Sync: Retry 1 on block 5c956db7  
Nov 22 23:35:08.583 DEBG Requesting block 5c956db7 from peer 51.15.86.81:13414.  
Nov 22 23:35:08.583 DEBG Sync: Retry 1 on block 96d66a33  
Nov 22 23:35:08.583 DEBG Requesting block 96d66a33 from peer 91.134.132.74:13414.  
Nov 22 23:35:08.584 DEBG Sync: Retry 1 on block 7f61757b  
Nov 22 23:35:08.584 DEBG Requesting block 7f61757b from peer 51.15.219.12:13414.  
Nov 22 23:35:08.584 DEBG Sync: Retry 1 on block 5a3f9bec  
Nov 22 23:35:08.584 DEBG Requesting block 5a3f9bec from peer 51.15.219.12:13414.  
Nov 22 23:35:08.585 DEBG Sync: Retry 0 on block 03e039a6  
Nov 22 23:35:08.585 DEBG Requesting block 03e039a6 from peer 108.253.243.102:13414.  
Nov 22 23:35:08.585 DEBG Sync: Retry 0 on block ca4eff40  
Nov 22 23:35:08.586 DEBG Requesting block ca4eff40 from peer 37.59.48.28:13414.  
Nov 22 23:35:08.586 DEBG Requesting block 17af9b5a from peer 94.130.66.48:13414.  
thread 'main' panicked at 'already borrowed: BorrowMutError', /checkout/src/libcore/result.rs:906:4  
   0:     0x55a4005653d3 - std::sys::imp::backtrace::tracing::imp::unwind_backtrace::hfc7985b08e763a82  
                               at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49  
   1:     0x55a4005613c4 - std::sys_common::backtrace::_print::h16a1db02a59ead63  
                               at /checkout/src/libstd/sys_common/backtrace.rs:71  
   2:     0x55a400568943 - std::panicking::default_hook::{{closure}}::h48ecee46f2eefc30  
                               at /checkout/src/libstd/sys_common/backtrace.rs:60  
                               at /checkout/src/libstd/panicking.rs:381  
   3:     0x55a4005686b2 - std::panicking::default_hook::hb4c92ae8d005ca44
                               at /checkout/src/libstd/panicking.rs:397
   4:     0x55a400568e07 - std::panicking::rust_panic_with_hook::h25d461655d60b1a5
                               at /checkout/src/libstd/panicking.rs:611
   5:     0x55a400568c64 - std::panicking::begin_panic::h0f6fdd9abfd7dfb9
                               at /checkout/src/libstd/panicking.rs:572
   6:     0x55a400568bd9 - std::panicking::begin_panic_fmt::ha31e26b280c9e878
                               at /checkout/src/libstd/panicking.rs:522
   7:     0x55a400568b6a - rust_begin_unwind
                               at /checkout/src/libstd/panicking.rs:498
   8:     0x55a4005a1980 - core::panicking::panic_fmt::h67504914198d0451
                               at /checkout/src/libcore/panicking.rs:71
   9:     0x55a4005a18b6 - core::panicking::panic::hc8058a23bb7ed97d
                               at /checkout/src/libcore/panicking.rs:51
  10:     0x55a3ff9e176a - <core::option::Option<T>>::unwrap::h448a7553d6896427
                               at /checkout/src/libcore/macros.rs:32
  11:     0x55a3ff9da0e9 - <grin_util::OneTime<T>>::borrow::{{closure}}::h3b09ff9f48002041
                               at /home/stelmaria/src/grin/util/src/lib.rs:96
  12:     0x55a3ff9eff18 - <core::cell::Ref<'b, T>>::map::h722ebb27c0851025
                               at /checkout/src/libcore/cell.rs:1017
  13:     0x55a3ff9da0ab - <grin_util::OneTime<T>>::borrow::hb74ad2a66a43cc4a
                               at /home/stelmaria/src/grin/util/src/lib.rs:96
  14:     0x55a3ffabfab0 - grin_p2p::protocol::ProtocolV1::send_request::h152040b5b1b327c6
                               at /home/stelmaria/src/grin/p2p/src/protocol.rs:131
  15:     0x55a3ffabf77e - <grin_p2p::protocol::ProtocolV1 as grin_p2p::types::Protocol>::send_block_request::h9695040f5dc80e50
                               at /home/stelmaria/src/grin/p2p/src/protocol.rs:99
  16:     0x55a3ffabdeec - grin_p2p::peer::Peer::send_block_request::hc10fdce94a7877af
                               at /home/stelmaria/src/grin/p2p/src/peer.rs:172
  17:     0x55a3ff0becf0 - grin_grin::sync::Syncer::request_block::h04f7fd7974d0167f
                               at /home/stelmaria/src/grin/grin/src/sync.rs:321
  18:     0x55a3ff0bc34f - grin_grin::sync::Syncer::request_bodies::hc11032f798f9c28b
                               at /home/stelmaria/src/grin/grin/src/sync.rs:212
  19:     0x55a3ff0baa0c - grin_grin::sync::Syncer::run::hdd6239c83e88aa5b
                               at /home/stelmaria/src/grin/grin/src/sync.rs:138
  20:     0x55a3ff0af70e - grin_grin::adapters::NetToChainAdapter::start_sync::{{closure}}::h9b686d6c6c17353b
                               at /home/stelmaria/src/grin/grin/src/adapters.rs:300
  21:     0x55a3feeded2c - std::sys_common::backtrace::__rust_begin_short_backtrace::h05d9beee3047197e
                               at /checkout/src/libstd/sys_common/backtrace.rs:136
  22:     0x55a3feefafcc - std::thread::Builder::spawn::{{closure}}::{{closure}}::h92d28f8a817bb343
                               at /checkout/src/libstd/thread/mod.rs:394
  23:     0x55a3fee891bc - <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h9867e2ea843656d4
                               at /checkout/src/libstd/panic.rs:296
  24:     0x55a3feefc299 - std::panicking::try::do_call::ha9007d265c14488e
                               at /checkout/src/libstd/panicking.rs:480
  25:     0x55a40056feec - __rust_maybe_catch_panic
                               at /checkout/src/libpanic_unwind/lib.rs:99
  26:     0x55a3feefb5ea - std::panicking::try::h1bbba89ea2b784eb
                               at /checkout/src/libstd/panicking.rs:459
  27:     0x55a3feef73e3 - std::panic::catch_unwind::he24b0607d0ee7bc7
                               at /checkout/src/libstd/panic.rs:361
  28:     0x55a3feefaaa5 - std::thread::Builder::spawn::{{closure}}::hde0089dd90b757ba
                               at /checkout/src/libstd/thread/mod.rs:393
  29:     0x55a3fefa868f - <F as alloc::boxed::FnBox<A>>::call_box::h381a24e23a1174de
                               at /checkout/src/liballoc/boxed.rs:682
  30:     0x55a400567cab - std::sys::imp::thread::Thread::new::thread_start::hf0e7be833820328e
                               at /checkout/src/liballoc/boxed.rs:692
                               at /checkout/src/libstd/sys_common/thread.rs:21
                               at /checkout/src/libstd/sys/unix/thread.rs:84
  31:     0x7faf04a156b9 - start_thread
  32:     0x7faf045353dc - clone
  33:                0x0 - <unknown>
stack backtrace:
   0:     0x55a4005653d3 - std::sys::imp::backtrace::tracing::imp::unwind_backtrace::hfc7985b08e763a82
                               at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1:     0x55a4005613c4 - std::sys_common::backtrace::_print::h16a1db02a59ead63
                               at /checkout/src/libstd/sys_common/backtrace.rs:71
   2:     0x55a400568943 - std::panicking::default_hook::{{closure}}::h48ecee46f2eefc30
                               at /checkout/src/libstd/sys_common/backtrace.rs:60
                               at /checkout/src/libstd/panicking.rs:381
   3:     0x55a4005686b2 - std::panicking::default_hook::hb4c92ae8d005ca44
                               at /checkout/src/libstd/panicking.rs:397
   4:     0x55a400568e07 - std::panicking::rust_panic_with_hook::h25d461655d60b1a5
                               at /checkout/src/libstd/panicking.rs:611
   5:     0x55a400568c64 - std::panicking::begin_panic::h0f6fdd9abfd7dfb9
                               at /checkout/src/libstd/panicking.rs:572
   6:     0x55a400568bd9 - std::panicking::begin_panic_fmt::ha31e26b280c9e878
                               at /checkout/src/libstd/panicking.rs:522
   7:     0x55a400568b6a - rust_begin_unwind
                               at /checkout/src/libstd/panicking.rs:498
   8:     0x55a4005a1980 - core::panicking::panic_fmt::h67504914198d0451
                               at /checkout/src/libcore/panicking.rs:71
   9:     0x55a3ffa352d7 - core::result::unwrap_failed::h8b14e38df868791c
                               at /checkout/src/libcore/macros.rs:41
  10:     0x55a3ff9fc8a3 - <core::result::Result<T, E>>::expect::he05942aab137f38c
                               at /checkout/src/libcore/result.rs:799
  11:     0x55a3ff9da149 - <core::cell::RefCell<T>>::borrow_mut::h55fcbb295211c036
                               at /checkout/src/libcore/cell.rs:749
  12:     0x55a3ff9d9ea3 - <grin_util::OneTime<T>>::init::h298ba747a7617a5d
                               at /home/stelmaria/src/grin/util/src/lib.rs:84
  13:     0x55a3ffabf1ad - <grin_p2p::protocol::ProtocolV1 as grin_p2p::types::Protocol>::handle::h600ec25990588e8f
                               at /home/stelmaria/src/grin/p2p/src/protocol.rs:58
  14:     0x55a3ffabcaa2 - grin_p2p::peer::Peer::run::he391fd3bb74f721d
                               at /home/stelmaria/src/grin/p2p/src/peer.rs:97
  15:     0x55a3ffac6f34 - grin_p2p::server::Server::connect_peer::{{closure}}::h56ee519de87b5448
                               at /home/stelmaria/src/grin/p2p/src/server.rs:223
  16:     0x55a3ff9c5e20 - <futures::future::and_then::AndThen<A, B, F> as futures::future::Future>::poll::{{closure}}::{{closure}}::hb7417f7366207efa
                               at /home/stelmaria/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.17/src/future/and_then.rs:34
  17:     0x55a3ff9fbc66 - <core::result::Result<T, E>>::map::hf4b998933542d19a
                               at /checkout/src/libcore/result.rs:468
  18:     0x55a3ff9c37cf - <futures::future::and_then::AndThen<A, B, F> as futures::future::Future>::poll::{{closure}}::h5aecddafeafefcf0
                               at /home/stelmaria/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.17/src/future/and_then.rs:33
  19:     0x55a3ffa61eb9 - <futures::future::chain::Chain<A, B, C>>::poll::hbd8e1d08403e344f
                               at /home/stelmaria/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.17/src/future/chain.rs:39
  20:     0x55a3ff9c2813 - <futures::future::and_then::AndThen<A, B, F> as futures::future::Future>::poll::h1be5a2db2ef36a74
                               at /home/stelmaria/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.17/src/future/and_then.rs:32
  21:     0x55a3ff01d3f6 - <alloc::boxed::Box<F> as futures::future::Future>::poll::h82eb019db37648a0
                               at /home/stelmaria/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.17/src/future/mod.rs:113
  22:     0x55a3ff0992ca - <futures::future::map_err::MapErr<A, F> as futures::future::Future>::poll::h30d8961ac7e5e8dd
                               at /home/stelmaria/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.17/src/future/map_err.rs:30
  23:     0x55a3ff06b0ec - <tokio_timer::timer::Timeout<F> as futures::future::Future>::poll::he54195b2a2ac85cf
                               at /home/stelmaria/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-timer-0.1.2/src/timer.rs:308
  24:     0x55a3feffb39f - <futures::future::chain::Chain<A, B, C>>::poll::hf953ac7ea7c61b73
                               at /home/stelmaria/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.17/src/future/chain.rs:26
  25:     0x55a3ff09ec8c - <futures::future::then::Then<A, B, F> as futures::future::Future>::poll::hd0e2a9177d01282f
                               at /home/stelmaria/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.17/src/future/then.rs:32
  26:     0x55a3ff01d4df - <alloc::boxed::Box<F> as futures::future::Future>::poll::hf17d7ff50a45053b
                               at /home/stelmaria/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.17/src/future/mod.rs:113
  27:     0x55a3ffdb171f - <alloc::boxed::Box<F> as futures::future::Future>::poll::hf68a8a6d89b6a20a
                               at /home/stelmaria/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.17/src/future/mod.rs:113
  28:     0x55a3ffd967dc - <futures::task_impl::Spawn<T>>::poll_future_notify::{{closure}}::h4599681781169e7d
                               at /home/stelmaria/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.17/src/task_impl/mod.rs:288
  29:     0x55a3ffd96c5f - <futures::task_impl::Spawn<T>>::enter::{{closure}}::h1f359600cedb86b2
                               at /home/stelmaria/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.17/src/task_impl/mod.rs:362
  30:     0x55a3ffdb3018 - futures::task_impl::std::set::hfdd56af9979d8d2a
                               at /home/stelmaria/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.17/src/task_impl/std/mod.rs:78
  31:     0x55a3ffd96a5b - <futures::task_impl::Spawn<T>>::enter::h1f68ea1338268f70
                               at /home/stelmaria/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.17/src/task_impl/mod.rs:362
  32:     0x55a3ffd967a4 - <futures::task_impl::Spawn<T>>::poll_future_notify::hd1d9be0c0f6641ad
                               at /home/stelmaria/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.17/src/task_impl/mod.rs:288
  33:     0x55a3ffdbed9f - tokio_core::reactor::Core::dispatch_task::{{closure}}::h93f295274572e9a4
                               at /home/stelmaria/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-core-0.1.10/src/reactor/mod.rs:356
  34:     0x55a3ffd93342 - <scoped_tls::ScopedKey<T>>::set::hbee7f45922c69b98
                               at /home/stelmaria/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-0.1.0/src/lib.rs:135
  35:     0x55a3ffdbe6b0 - tokio_core::reactor::Core::dispatch_task::h1b06f815bb4df586
                               at /home/stelmaria/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-core-0.1.10/src/reactor/mod.rs:355
  36:     0x55a3ffdbd975 - tokio_core::reactor::Core::dispatch::h222791201ee03fe9
                               at /home/stelmaria/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-core-0.1.10/src/reactor/mod.rs:316
  37:     0x55a3ffdbd470 - tokio_core::reactor::Core::poll::hb51e0366dfb3392f
                               at /home/stelmaria/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-core-0.1.10/src/reactor/mod.rs:304
  38:     0x55a3fee952a2 - tokio_core::reactor::Core::run::h7bef39177f07b91d
                               at /home/stelmaria/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-core-0.1.10/src/reactor/mod.rs:241
  39:     0x55a3ff0b0cff - grin_grin::server::Server::start::hf65bcf9cfa39d7c9
                               at /home/stelmaria/src/grin/grin/src/server.rs:77
  40:     0x55a3fedb866c - grin::server_command::hd95074537eb9b6cc
                               at /home/stelmaria/src/grin/src/bin/grin.rs:342
  41:     0x55a3fedb6f3a - grin::main::heb73893507a6a4c7
                               at /home/stelmaria/src/grin/src/bin/grin.rs:271
  42:     0x55a40056feec - __rust_maybe_catch_panic
                               at /checkout/src/libpanic_unwind/lib.rs:99
  43:     0x55a40056952b - std::rt::lang_start::hdcba96cc6d0f043d
                               at /checkout/src/libstd/panicking.rs:459
                               at /checkout/src/libstd/panic.rs:361
                               at /checkout/src/libstd/rt.rs:61
  44:     0x55a3fedbb862 - main
  45:     0x7faf0444e82f - __libc_start_main
  46:     0x55a3fed7c898 - _start
  47:                0x0 - <unknown>
d4a405c6 at 8990.
Nov 22 23:35:00.354 DEBG Validating block with cuckoo size 16
Nov 22 23:35:00.367 DEBG Processing header 156593c8 at 8991.
Nov 22 23:35:00.368 DEBG Validating block with cuckoo size 16
Nov 22 23:35:00.382 DEBG Processing header d7ba102e at 8992.

grin-borrowmuterror.log.gz

ignopeverell commented 6 years ago

I'll assume that was caused by an issue with the older Syncer, feel free to reopen if it still happens.