autopush-rs icon indicating copy to clipboard operation
autopush-rs copied to clipboard

Convert "Too many connections" panic to a normal DbError

Open data-sync-user opened this issue 2 months ago • 1 comments

Sentry Issue: TOKENSERVER-PROD-B

panic: called `Result::unwrap()` on an `Err` value: ApiError { kind: Db(DbError { kind: Pool(Error(Some("Too many connections"))), status: 500, backtrace:    0: <syncserver_db_common::error::DbError as core::convert::From<syncserver_db_common::error::DbErrorKind>>::from
             at syncserver-db-common/src/error.rs:119:24
      <T as core::convert::Into<U>>::into
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/convert/mod.rs:552:9
      <syncserver_db_common::error::DbError as core::convert::From<r2d2::Error>>::from
             at syncserver-common/src/lib.rs:31:17
   1: <core::result::Result<T,F> as core::ops::try_trait::FromResidual<core::result::Result<core::convert::Infallible,E>>>::from_residual
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/result.rs:2105:27
      syncserver::tokenserver::db::pool::TokenserverPool::new
             at syncserver/src/tokenserver/db/pool.rs:71:20
   2: syncserver::tokenserver::ServerState::from_settings
             at syncserver/src/tokenserver/mod.rs:57:9
   3: syncserver::server::Server::tokenserver_only_with_settings::{{closure}}
             at syncserver/src/server/mod.rs:338:33
      <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/future/mod.rs:91:19
      syncserver::main::{{closure}}
             at syncserver/src/main.rs:53:13
   4: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/future/mod.rs:91:19
      <tokio::task::local::RunUntil<T> as core::future::future::Future>::poll::{{closure}}::{{closure}}
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/task/local.rs:528:65
      tokio::coop::with_budget::{{closure}}
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/coop.rs:127:9
      std::thread::local::LocalKey<T>::try_with
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/thread/local.rs:445:16
      std::thread::local::LocalKey<T>::with
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/thread/local.rs:421:9
   5: tokio::coop::with_budget
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/coop.rs:120:5
      tokio::coop::budget
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/coop.rs:96:5
      <tokio::task::local::RunUntil<T> as core::future::future::Future>::poll::{{closure}}
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/task/local.rs:528:42
      tokio::macros::scoped_tls::ScopedKey<T>::set
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/macros/scoped_tls.rs:63:9
   6: tokio::task::local::LocalSet::with
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/task/local.rs:442:9
      <tokio::task::local::RunUntil<T> as core::future::future::Future>::poll
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/task/local.rs:518:9
      tokio::task::local::LocalSet::run_until::{{closure}}
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/task/local.rs:392:18
      <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/future/mod.rs:91:19
   7: tokio::runtime::shell::Shell::block_on::{{closure}}
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/runtime/shell.rs:43:54
      tokio::coop::with_budget::{{closure}}
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/coop.rs:127:9
      std::thread::local::LocalKey<T>::try_with
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/thread/local.rs:445:16
      std::thread::local::LocalKey<T>::with
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/thread/local.rs:421:9
   8: tokio::coop::with_budget
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/coop.rs:120:5
      tokio::coop::budget
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/coop.rs:96:5
      tokio::runtime::basic_scheduler::BasicScheduler<P>::block_on::{{closure}}
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/runtime/basic_scheduler.rs:131:35
      tokio::runtime::basic_scheduler::enter::{{closure}}
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/runtime/basic_scheduler.rs:213:29
      tokio::macros::scoped_tls::ScopedKey<T>::set
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/macros/scoped_tls.rs:63:9
      tokio::runtime::basic_scheduler::enter
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/runtime/basic_scheduler.rs:213:5
      tokio::runtime::basic_scheduler::BasicScheduler<P>::block_on
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/runtime/basic_scheduler.rs:123:9
   9: tokio::runtime::Runtime::block_on::{{closure}}
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/runtime/mod.rs:444:34
      tokio::runtime::context::enter
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/runtime/context.rs:72:5
  10: tokio::runtime::handle::Handle::enter
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/runtime/handle.rs:76:9
      tokio::runtime::Runtime::block_on
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/runtime/mod.rs:441:9
  11: tokio::task::local::LocalSet::block_on
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.25/src/task/local.rs:353:9
      actix_rt::runtime::Runtime::block_on
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/actix-rt-1.1.1/src/runtime.rs:89:9
      actix_rt::builder::SystemRunner::block_on
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/actix-rt-1.1.1/src/builder.rs:187:19
      syncserver::main
             at syncserver/src/main.rs:27:1
  12: core::ops::function::FnOnce::call_once
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/ops/function.rs:248:5
      std::sys_common::backtrace::__rust_begin_short_backtrace
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/sys_common/backtrace.rs:122:18
  13: std::rt::lang_start::{{closure}}
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/rt.rs:166:18
  14: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/ops/function.rs:283:13
      std::panicking::try::do_call
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/panicking.rs:492:40
      std::panicking::try
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/panicking.rs:456:19
      std::panic::catch_unwind
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/panic.rs:137:14
      std::rt::lang_start_internal::{{closure}}
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/rt.rs:148:48
      std::panicking::try::do_call
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/panicking.rs:492:40
      std::panicking::try
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/panicking.rs:456:19
      std::panic::catch_unwind
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/panic.rs:13...
  File "panicking.rs", line 584, in rust_begin_unwind
  File "main.rs", line 52, in syncserver::main::{{closure}}
  File "local.rs", line 528, in tokio::task::local::RunUntil<T>::poll::{{closure}}::{{closure}}
  File "coop.rs", line 127, in tokio::coop::with_budget::{{closure}}
  File "coop.rs", line 120, in tokio::coop::with_budget
...
(48 additional frame(s) were not displayed)

┆Issue is synchronized with this Jira Bug

data-sync-user avatar Apr 22 '24 21:04 data-sync-user

➤ Philip Jenvey commented:

JR Conlin this one occurs during initialization in main, so converting it to an Error won’t do too much, the process will still exit anyway. I’m not opposed to changing the unwrap() that triggers this to propagate the error out of main() though.

data-sync-user avatar Apr 22 '24 21:04 data-sync-user