nmandery / rout3serv

H3-grid based Routing server with GRPC-API and dataframe integration
0 stars 0 forks source link

Avoid unwraping channel-send result when streaming recordbatches #12

Closed nmandery closed 3 years ago

nmandery commented 3 years ago

https://github.com/nmandery/route3/blob/f99a1960b7628e394336806ce162c6240e3c9df6/route3_road/src/server/util.rs#L83

May result in

thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: SendError(Ok(ArrowRecordBatch { object_id: "26e1062e-0fe7-487c-8d54-4d36615a73a8", data: [65, 82, 82, 79, 87, 49, 0, 0, 255, 255, 255, 255, 0, 12, 0, 0, 16, 0, 0, 0, 0, 0, 10, 0, 14, 0, 12, 0, 11, 0, 4, 0, 10, 0, 0, 0, 20, 0, 0, 0, 0, 
...
 79, 87, 49] }))', route3_road/src/s
erver/util.rs:83:49
   3: core::result::Result<T,E>::unwrap
             at ./rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/result.rs:1299:23
   4: route3_road::server::util::stream_recordbatches::{{closure}}::{{closure}}
             at ./build/route3_road/src/server/util.rs:83:13
   5: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at ./rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/future/mod.rs:80:19
   6: tokio::runtime::task::core::CoreStage<T>::poll::{{closure}}
             at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/runtime/task/core.rs:161:17
   7: tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut
             at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/loom/std/unsafe_cell.rs:14:9
   8: tokio::runtime::task::core::CoreStage<T>::poll
             at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/runtime/task/core.rs:151:13
   9: tokio::runtime::task::harness::poll_future::{{closure}}
             at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/runtime/task/harness.rs:461:19
  10: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at ./rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/panic/unwind_safe.rs:271:9
  11: std::panicking::try::do_call
             at ./rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:403:40
  12: std::panicking::try
             at ./rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:367:19
  13: std::panic::catch_unwind
             at ./rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panic.rs:129:14
  14: tokio::runtime::task::harness::poll_future
             at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/runtime/task/harness.rs:449:18
  15: tokio::runtime::task::harness::Harness<T,S>::poll_inner
             at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/runtime/task/harness.rs:98:27
  16: tokio::runtime::task::harness::Harness<T,S>::poll
             at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/runtime/task/harness.rs:53:15
  17: tokio::runtime::task::raw::poll
             at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/runtime/task/raw.rs:113:5
  18: tokio::runtime::task::raw::RawTask::poll
             at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/runtime/task/raw.rs:70:18
  19: tokio::runtime::task::LocalNotified<S>::run
             at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/runtime/task/mod.rs:343:9
  20: tokio::runtime::thread_pool::worker::Context::run_task::{{closure}}
             at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/runtime/thread_pool/worker.rs:443:21
  21: tokio::coop::with_budget::{{closure}}
             at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/coop.rs:106:9
  22: std::thread::local::LocalKey<T>::try_with
             at ./rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/thread/local.rs:399:16
  23: std::thread::local::LocalKey<T>::with
             at ./rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/thread/local.rs:375:9
  24: tokio::coop::with_budget
             at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/coop.rs:99:5
  25: tokio::coop::budget
             at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/coop.rs:76:5
  26: tokio::runtime::thread_pool::worker::Context::run_task
             at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/runtime/thread_pool/worker.rs:419:9
  27: tokio::runtime::thread_pool::worker::Context::run
             at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/runtime/thread_pool/worker.rs:393:24
  28: tokio::runtime::thread_pool::worker::run::{{closure}}
             at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/runtime/thread_pool/worker.rs:371:17
  29: tokio::macros::scoped_tls::ScopedKey<T>::set
             at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/macros/scoped_tls.rs:61:9
  30: tokio::runtime::thread_pool::worker::run
             at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/runtime/thread_pool/worker.rs:368:5
  31: tokio::runtime::thread_pool::worker::block_in_place::{{closure}}::{{closure}}
             at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/runtime/thread_pool/worker.rs:324:41
  32: <tokio::runtime::blocking::task::BlockingTask<T> as core::future::future::Future>::poll
             at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/runtime/blocking/task.rs:42:21
  33: tokio::runtime::task::core::CoreStage<T>::poll::{{closure}}
             at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/runtime/task/core.rs:161:17
  34: tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut
             at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/loom/std/unsafe_cell.rs:14:9
  35: tokio::runtime::task::core::CoreStage<T>::poll
             at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/runtime/task/core.rs:151:13
  36: tokio::runtime::task::harness::poll_future::{{closure}}
             at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/runtime/task/harness.rs:461:19
  37: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at ./rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/panic/unwind_safe.rs:271:9
  38: std::panicking::try::do_call
             at ./rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:403:40
  39: std::panicking::try
             at ./rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:367:19
  40: std::panic::catch_unwind
             at ./rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panic.rs:129:14
  41: tokio::runtime::task::harness::poll_future
             at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/runtime/task/harness.rs:449:18
  42: tokio::runtime::task::harness::Harness<T,S>::poll_inner
             at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/runtime/task/harness.rs:98:27
  43: tokio::runtime::task::harness::Harness<T,S>::poll
             at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/runtime/task/harness.rs:53:15
  44: tokio::runtime::task::raw::poll
             at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/runtime/task/raw.rs:113:5
  45: tokio::runtime::task::raw::RawTask::poll
             at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/runtime/task/raw.rs:70:18
  46: tokio::runtime::task::UnownedTask<S>::run
             at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/runtime/task/mod.rs:379:9
  47: tokio::runtime::blocking::pool::Inner::run
             at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/runtime/blocking/pool.rs:265:17
  48: tokio::runtime::blocking::pool::Spawner::spawn_thread::{{closure}}
             at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.13.0/src/runtime/blocking/pool.rs:245:17
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: rust_begin_unwind
             at ./rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:517:5
   1: core::panicking::panic_fmt
             at ./rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/panicking.rs:101:14
   2: core::result::unwrap_failed
             at ./rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/result.rs:1617:5
   3: core::result::Result<T,E>::unwrap

... propably when the connection was closed in the meantime.