input-output-hk / jormungandr

privacy voting blockchain node
https://input-output-hk.github.io/jormungandr/
Apache License 2.0
364 stars 132 forks source link

Panic at 'the longest chain to be indexed' #976

Open manveru opened 5 years ago

manveru commented 5 years ago

Describe the bug

The query used by the explorer on https://explorer.jormungandr-testnet.iohkdev.io/block/chainLength/0 is

{
  "query": "query BlockByLengthSearchResultQuery(\n  $length: ChainLength!\n) {\n  blockByChainLength(length: $length) {\n    ...FullBlockInfo_block\n  }\n}\n\nfragment FullBlockInfo_block on Block {\n  id\n  date {\n    epoch {\n      id\n    }\n    slot\n  }\n  chainLength\n  previousBlock {\n    id\n  }\n  transactions {\n    ...TransactionTable_transactions\n  }\n}\n\nfragment TransactionTable_transactions on Transaction {\n  id\n  inputs {\n    amount\n  }\n  outputs {\n    amount\n  }\n  block {\n    id\n  }\n}\n",
  "variables": {
    "length": "0"
  }
}

Readable version of only the query:

query BlockByLengthSearchResultQuery(
  $length: ChainLength!
) {
  blockByChainLength(length: $length) {
    ...FullBlockInfo_block
  }
}

fragment FullBlockInfo_block on Block {
  id
  date {
    epoch {
      id
    }
    slot
  }
  chainLength
  previousBlock {
    id
  }
  transactions {
    ...TransactionTable_transactions
  }
}

fragment TransactionTable_transactions on Transaction {
  id
  inputs {
    amount
  }
  outputs {
    amount
  }
  block {
    id
  }
}

Raises the following exception:

thread 'actix-web' panicked at 'the longest chain to be indexed', src/libcore/option.rs:1034:5
stack backtrace:
   0:     0x561c445dbf2b - std::panicking::default_hook::{{closure}}::h847a2eb38b396f14
   1:     0x561c445dbc07 - std::panicking::default_hook::h2ca0f9a30a0e206b
   2:     0x561c445dc6a0 - std::panicking::rust_panic_with_hook::hffcefc09751839d1
   3:     0x561c445dc222 - std::panicking::continue_panic_fmt::hc0f142c930c846fc
   4:     0x561c445dc106 - rust_begin_unwind
   5:     0x561c445f93cd - core::panicking::panic_fmt::h2daf88b2616ca2b2
   6:     0x561c445f9437 - core::option::expect_failed::h4b77ebe6e62ec3a1
   7:     0x561c43fb8ff6 - futures::future::chain::Chain<A,B,C>::poll::h8979c70c0e5fafa2
   8:     0x561c43fc7f38 - futures::future::chain::Chain<A,B,C>::poll::ha3c63bb3e2d3c0d0
   9:     0x561c43ea0aa4 - futures::task_impl::std::set::ha61e8821008c0887
  10:     0x561c44106e93 - std::thread::local::LocalKey<T>::with::h444ecb6b3fe8fdfa
  11:     0x561c43d13cb3 - futures::future::Future::wait::h92a124c1cc5c40c3
  12:     0x561c44010051 - <jormungandr::explorer::graphql::Query as juniper::types::base::GraphQLType>::resolve_field::h65eecfe51853b7f5
  13:     0x561c440dc3b2 - juniper::schema::schema::<impl juniper::types::base::GraphQLType<S> for juniper::schema::model::RootNode<QueryT,MutationT,S>>::resolve_field::hc8ad850b2a988e5a
  14:     0x561c43c6b09a - juniper::types::base::resolve_selection_set_into::ha45fa9d39f1c975a
  15:     0x561c440d5af8 - juniper::types::pointers::<impl juniper::types::base::GraphQLType<S> for &T>::resolve::h23c5804d9f80fbf0
  16:     0x561c43e36eb2 - juniper::executor::execute_validated_query::h3ee17b388fe7b29e
  17:     0x561c440dd8b0 - juniper::execute::h226239382b896fae
  18:     0x561c4412b1fe - juniper::http::GraphQLRequest<S>::execute::hda99dabeec7c3b10
  19:     0x561c43c9caa2 - <F as threadpool::FnBox>::call_box::h4688e4b53e6f0f3d
  20:     0x561c444fd923 - std::sys_common::backtrace::__rust_begin_short_backtrace::h4516a79e263ed9c2
  21:     0x561c445e09fa - __rust_maybe_catch_panic
  22:     0x561c444fb068 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hf9b4e97bfcd7d469
  23:     0x561c445ccf4f - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h42806b83647d4c79
  24:     0x561c445dfda0 - std::sys::unix::thread::Thread::new::thread_start::h4570080769500bcd
  25:     0x7f9093aa4ef7 - start_thread
  26:     0x7f90937c222f - __GI___clone
  27:                0x0 - <unknown>

Mandatory Information

  1. jcli --full-version output; jcli 0.6.1 (, release, linux [x86_64]) - [rustc 1.37.0 (eae3437df 2019-08-13)]
  2. jormungandr --full-version output; jormungandr 0.6.1 (, release, linux [x86_64]) - [rustc 1.37.0 (eae3437df 2019-08-13)]

To Reproduce Steps to reproduce the behavior:

  1. Go to https://explorer.jormungandr-testnet.iohkdev.io/block/chainLength/0
  2. See on the network inspector that it returns a 500 for the query
  3. Check on the corresponding node to see the panic

Expected behavior See block 0

Additional context This seems to have broken recently.

ecioppettini commented 5 years ago

Any explorer errors in the logs? That shouldn't happen, did it start happening after a restart?