Repository: rwf2/Rocket (language: rust)

Issue:
Sometimes cargo test fails with async requests (master)
**Version:** latest master
**OS:** Ubuntu 20.10
**Description:** Following code works fine in normal conditions, but when running with `cargo test` sometimes it fails with double panic. Couldn't reproduce it with one test.

**Code:**
```rust
#![feature(proc_macro_hygiene, decl_macro)]
#[macro_use] extern crate rocket;
#[macro_use] extern crate rocket_contrib;

use rocket_contrib::databases::postgres;
use rocket::{Rocket, Build};


#[database("storage")]
pub struct ApiDatabase(postgres::Client);


#[get("/")]
async fn get_entries(conn: ApiDatabase) -> &'static str {
    println!("Running database task..");

    let _some_result = conn.run(|c| c.query("SELECT * FROM entries", &[])).await;

    println!("Ran database task!");
    "Works!?"
}


#[launch]
fn rocket() -> Rocket<Build> {
    rocket::build()
        .mount("/entries", routes![get_entries])
        .attach(ApiDatabase::fairing())
}


#[cfg(test)]
mod test {
    use super::rocket;

    #[rocket::async_test]
    async fn test_get_entries() {
        use rocket::local::asynchronous::Client;

        let client = Client::tracked(rocket()).await.unwrap();
        // The code below breaks as well, but it's much harder to reproduce with the debugger
        //let _resp  = client.get("/entries").dispatch().await;
        let (_r1, _r2, _r3, _r4) = rocket::tokio::join!(
            client.get("/entries").dispatch(),
            client.get("/entries").dispatch(),
            client.get("/entries").dispatch(),
            client.get("/entries").dispatch()
        );
    }

    #[rocket::async_test]
    async fn test_get_entries_2() {
        use rocket::local::asynchronous::Client;

        let client = Client::tracked(rocket()).await.unwrap();
        // The code below breaks as well, but it's much harder to reproduce with the debugger
        //let _resp  = client.get("/entries").dispatch().await;
        let (_r1, _r2, _r3, _r4) = rocket::tokio::join!(
            client.get("/entries").dispatch(),
            client.get("/entries").dispatch(),
            client.get("/entries").dispatch(),
            client.get("/entries").dispatch()
        );
    }
}
```

**Issue:**
```bash
$ cargo test
    Finished test [unoptimized + debuginfo] target(s) in 0.07s
     Running unittests (target/debug/deps/rocket_bug_repro-5b440ae7b98fd091)

running 2 tests
test test::test_get_entries_2 ... ok
thread panicked while panicking. aborting.
error: test failed, to rerun pass '--bin rocket-bug-repro'

Caused by:
  process didn't exit successfully: `/home/kittyandrew/tmp/rocket-bug-repro/target/debug/deps/rocket_bug_repro-5b440ae7b98fd091` (signal: 4, SIGILL: illegal instruction)
```

**From the debugger:**
msg:
```
"Cannot start a runtime from within a runtime. This happens because a function (like `block_on`) attempted to block the current thread while the thread is being used to drive asynchronous tasks."
```


Discussion / hints:
The problem is a race condition somewhere in this code:

```rust
impl<K, C: Poolable> Drop for Connection<K, C> {
    fn drop(&mut self) {
        let connection = self.connection.clone();
        let permit = self.permit.take();

        // must spawn a task here...
        tokio::spawn(async move {
            // ...in order to wait for exclusive access to the connection (i.e. pending run() calls complete)
            // AWAIT POINT
            let mut connection = connection.lock_owned().await;

            // dropping the connection might communicate with the database (blocking I/O), so it has to be done in a `spawn_blocking` call
            tokio::task::spawn_blocking(move || {
                if let Some(conn) = connection.take() {
                    drop(conn);
                }

                // Explicitly dropping the permit here so that it's only
                // released after the connection is.
                drop(permit);
            })
        });
    }
}
```

What seems to be happening is that "AWAIT POINT" is reached, and then the test ends and the runtime is shut down before moving the `connection` to a blocking thread. Increasing the number of pending `run()` calls (e.g. with the `join!`) at the time of shutdown makes the problem more likely by increasing the contention at that particular `.await` point.

I will take a stab at accomplishing this in a way that is less likely to cause issues; a few APIs were recently exposed in `tokio` that I believe can make this easier to do correctly.
Thanks for the quick response!
Indeed, likelihood of catching this error rises not only with the increased usage of `join!`, but also with amount of tests themselves, which is quite annoying.
Looking forward for your solution.
@jebrosen issue is indeed fixed for the repro case, but everything hangs when the amount of tests is more than three. It stays hanged for ~25 seconds and then fails with the same error. I'm not sure whether it's similar issue thing, or some different bug.
> when the amount of tests is more than three

Can you run with `RUST_BACKTRACE=1 cargo test -- --nocapture` to get a complete backtrace? There may be another missing `spawn_blocking` call in a different location (which would lead to the same message).
Sure.

<details>

```
$ RUST_BACKTRACE=1 cargo test -- --nocapture
    Finished test [unoptimized + debuginfo] target(s) in 0.12s
     Running unittests (/home/kittyandrew/tmp/rocket-bug-repro/target/debug/deps/rocket_bug_repro-dc4482a295a94d90)

running 4 tests
thread 'test::test_get_entries_3' panicked at 'Cannot start a runtime from within a runtime. This happens because a function (like `block_on`) attempted to block the current thread while the thread is being used to drive asynchronous tasks.', /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/enter.rs:39:9
Error: database pool init error for pool named `storage`
stack backtrace:
   >> timed out waiting for connection: db error: FATAL: sorry, too many clients already
thread 'test::test_get_entries_2' panicked at 'called `Result::unwrap()` on an `Err` value: FailedFairings([Info { name: "'storage' Database Pool", kind: Kind(1) }])', src/main.rs:54:54
thread 'test::test_get_entries' panicked at 'Cannot start a runtime from within a runtime. This happens because a function (like `block_on`) attempted to block the current thread while the thread is being used to drive asynchronous tasks.', /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/enter.rs:39:9
thread 'test::test_get_entries_4' panicked at 'Cannot start a runtime from within a runtime. This happens because a function (like `block_on`) attempted to block the current thread while the thread is being used to drive asynchronous tasks.', /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/enter.rs:39:9
   0: std::panicking::begin_panic
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:519:12
   1: tokio::runtime::enter::enter
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/enter.rs:39:9
   2: tokio::runtime::basic_scheduler::Inner<P>::block_on::{{closure}}
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/basic_scheduler.rs:203:26
   3: tokio::runtime::basic_scheduler::enter::{{closure}}
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/basic_scheduler.rs:323:29
   4: tokio::macros::scoped_tls::ScopedKey<T>::set
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/macros/scoped_tls.rs:61:9
   5: tokio::runtime::basic_scheduler::enter
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/basic_scheduler.rs:323:5
   6: tokio::runtime::basic_scheduler::Inner<P>::block_on
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/basic_scheduler.rs:202:9
   7: tokio::runtime::basic_scheduler::InnerGuard<P>::block_on
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/basic_scheduler.rs:481:9
   8: tokio::runtime::basic_scheduler::BasicScheduler<P>::block_on
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/basic_scheduler.rs:162:24
   9: tokio::runtime::Runtime::block_on
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/mod.rs:450:46
  10: postgres::connection::Connection::poll_block_on
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/postgres-0.19.1/src/connection.rs:67:9
  11: postgres::client::Client::close_inner
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/postgres-0.19.1/src/client.rs:571:9
  12: <postgres::client::Client as core::ops::drop::Drop>::drop
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/postgres-0.19.1/src/client.rs:20:17
  13: core::ptr::drop_in_place<postgres::client::Client>
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  14: core::ptr::drop_in_place<r2d2::Conn<postgres::client::Client>>
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  15: core::ptr::drop_in_place<r2d2::IdleConn<postgres::client::Client>>
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  16: core::ptr::drop_in_place<[r2d2::IdleConn<postgres::client::Client>]>
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  17: <alloc::vec::Vec<T,A> as core::ops::drop::Drop>::drop
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs:2669:13
  18: core::ptr::drop_in_place<alloc::vec::Vec<r2d2::IdleConn<postgres::client::Client>>>
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  19: core::ptr::drop_in_place<r2d2::PoolInternals<postgres::client::Client>>
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  20: core::ptr::drop_in_place<core::cell::UnsafeCell<r2d2::PoolInternals<postgres::client::Client>>>
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  21: core::ptr::drop_in_place<lock_api::mutex::Mutex<parking_lot::raw_mutex::RawMutex,r2d2::PoolInternals<postgres::client::Client>>>
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  22: core::ptr::drop_in_place<r2d2::SharedPool<r2d2_postgres::PostgresConnectionManager<tokio_postgres::tls::NoTls>>>
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  23: alloc::sync::Arc<T>::drop_slow
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:1039:18
  24: <alloc::sync::Arc<T> as core::ops::drop::Drop>::drop
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:1571:13
  25: core::ptr::drop_in_place<alloc::sync::Arc<r2d2::SharedPool<r2d2_postgres::PostgresConnectionManager<tokio_postgres::tls::NoTls>>>>
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  26: core::ptr::drop_in_place<r2d2::Pool<r2d2_postgres::PostgresConnectionManager<tokio_postgres::tls::NoTls>>>
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  27: r2d2::config::Builder<M>::build
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/r2d2-0.8.9/src/config.rs:230:5
  28: <postgres::client::Client as rocket_contrib::databases::poolable::Poolable>::pool
             at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/contrib/lib/src/databases/poolable.rs:178:12
  29: rocket_contrib::databases::connection::ConnectionPool<K,C>::fairing::{{closure}}::{{closure}}
             at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/contrib/lib/src/databases/connection.rs:80:19
  30: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  31: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:120:9
  32: <rocket::fairing::ad_hoc::AdHoc as rocket::fairing::Fairing>::on_ignite::{{closure}}
             at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/core/lib/src/fairing/ad_hoc.rs:239:41
  33: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  34: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:120:9
  35: rocket::fairing::fairings::Fairings::handle_ignite::{{closure}}
             at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/core/lib/src/fairing/fairings.rs:58:32
  36: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  37: rocket::rocket::Rocket<rocket::phase::Build>::ignite::{{closure}}
             at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/core/lib/src/rocket.rs:467:16
  38: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  39: rocket::rocket::Rocket<P>::local_launch::{{closure}}
             at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/core/lib/src/rocket.rs:792:32
  40: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  41: rocket::local::asynchronous::client::Client::_new::{{closure}}
             at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/core/lib/src/local/asynchronous/client.rs:61:22
  42: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  43: rocket::local::asynchronous::client::Client::tracked::{{closure}}
             at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/core/lib/src/local/client.rs:71:9
  44: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  45: rocket_bug_repro::test::test_get_entries_3::{{closure}}
             at ./src/main.rs:69:22
  46: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  47: tokio::park::thread::CachedParkThread::block_on::{{closure}}
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/park/thread.rs:263:54
  48: tokio::coop::with_budget::{{closure}}
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/coop.rs:106:9
  49: std::thread::local::LocalKey<T>::try_with
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:272:16
  50: std::thread::local::LocalKey<T>::with
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:248:9
  51: tokio::coop::with_budget
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/coop.rs:99:5
  52: tokio::coop::budget
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/coop.rs:76:5
  53: tokio::park::thread::CachedParkThread::block_on
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/park/thread.rs:263:31
  54: tokio::runtime::enter::Enter::block_on
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/enter.rs:151:13
  55: tokio::runtime::thread_pool::ThreadPool::block_on
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/thread_pool/mod.rs:71:9
  56: tokio::runtime::Runtime::block_on
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/mod.rs:452:43
  57: rocket::async_test
             at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/core/lib/src/lib.rs:186:5
  58: rocket_bug_repro::test::test_get_entries_3
             at ./src/main.rs:68:35
  59: rocket_bug_repro::test::test_get_entries_3::{{closure}}
             at ./src/main.rs:68:11
  60: core::ops::function::FnOnce::call_once
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
  61: core::ops::function::FnOnce::call_once
             at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: rust_begin_unwind
             at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/std/src/panicking.rs:493:5
   1: core::panicking::panic_fmt
             at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/core/src/panicking.rs:92:14
   2: core::result::unwrap_failed
             at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/core/src/result.rs:1355:5
thread 'test::test_get_entries_3' panicked at 'Cannot start a runtime from within a runtime. This happens because a function (like `block_on`) attempted to block the current thread while the thread is being used to drive asynchronous tasks.', /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/enter.rs:39:9
   3: core::result::Result<T,E>::unwrap
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/result.rs:1037:23
   4: rocket_bug_repro::test::test_get_entries_2::{{closure}}
             at ./src/main.rs:54:22
   5: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
   6: tokio::park::thread::CachedParkThread::block_on::{{closure}}
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/park/thread.rs:263:54
   7: tokio::coop::with_budget::{{closure}}
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/coop.rs:106:9
   8: std::thread::local::LocalKey<T>::try_with
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:272:16
   9: std::thread::local::LocalKey<T>::with
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:248:9
  10: tokio::coop::with_budget
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/coop.rs:99:5
  11: tokio::coop::budget
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/coop.rs:76:5
  12: tokio::park::thread::CachedParkThread::block_on
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/park/thread.rs:263:31
  13: tokio::runtime::enter::Enter::block_on
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/enter.rs:151:13
  14: tokio::runtime::thread_pool::ThreadPool::block_on
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/thread_pool/mod.rs:71:9
  15: tokio::runtime::Runtime::block_on
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/mod.rs:452:43
  16: rocket::async_test
             at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/core/lib/src/lib.rs:186:5
  17: rocket_bug_repro::test::test_get_entries_2
             at ./src/main.rs:53:35
  18: rocket_bug_repro::test::test_get_entries_2::{{closure}}
             at ./src/main.rs:53:11
  19: core::ops::function::FnOnce::call_once
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
  20: core::ops::function::FnOnce::call_once
             at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::panicking::begin_panic
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:519:12
   1: tokio::runtime::enter::enter
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/enter.rs:39:9
   2: tokio::runtime::basic_scheduler::Inner<P>::block_on::{{closure}}
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/basic_scheduler.rs:203:26
   3: tokio::runtime::basic_scheduler::enter::{{closure}}
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/basic_scheduler.rs:323:29
   4: tokio::macros::scoped_tls::ScopedKey<T>::set
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/macros/scoped_tls.rs:61:9
   5: tokio::runtime::basic_scheduler::enter
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/basic_scheduler.rs:323:5
   6: tokio::runtime::basic_scheduler::Inner<P>::block_on
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/basic_scheduler.rs:202:9
   7: tokio::runtime::basic_scheduler::InnerGuard<P>::block_on
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/basic_scheduler.rs:481:9
   8: tokio::runtime::basic_scheduler::BasicScheduler<Ptest test::test_get_entries_2 ... >::FAILEDblock_on

             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/basic_scheduler.rs:162:24
   9: tokio::runtime::Runtime::block_on
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/mod.rs:450:46
  10: postgres::connection::Connection::poll_block_on
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/postgres-0.19.1/src/connection.rs:67:9
  11: postgres::client::Client::close_inner
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/postgres-0.19.1/src/client.rs:571:9
  12: <postgres::client::Client as core::ops::drop::Drop>::drop
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/postgres-0.19.1/src/client.rs:20:17
  13: core::ptr::drop_in_place<postgres::client::Client>
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  14: core::ptr::drop_in_place<r2d2::Conn<postgres::client::Client>>
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  15: core::ptr::drop_in_place<r2d2::IdleConn<postgres::client::Client>>
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  16: core::ptr::drop_in_place<[r2d2::IdleConn<postgres::client::Client>]>
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  17: <alloc::vec::Vec<T,A> as core::ops::drop::Drop>::drop
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs:2669:13
  18: core::ptr::drop_in_place<alloc::vec::Vec<r2d2::IdleConn<postgres::client::Client>>>
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  19: core::ptr::drop_in_place<r2d2::PoolInternals<postgres::client::Client>>
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  20: core::ptr::drop_in_place<core::cell::UnsafeCell<r2d2::PoolInternals<postgres::client::Client>>>
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  21: core::ptr::drop_in_place<lock_api::mutex::Mutex<parking_lot::raw_mutex::RawMutex,r2d2::PoolInternals<postgres::client::Client>>>
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  22: core::ptr::drop_in_place<r2d2::SharedPool<r2d2_postgres::PostgresConnectionManager<tokio_postgres::tls::NoTls>>>
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  23: alloc::sync::Arc<T>::drop_slow
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:1039:18
  24: <alloc::sync::Arc<T> as core::ops::drop::Drop>::drop
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:1571:13
  25: core::ptr::drop_in_place<alloc::sync::Arc<r2d2::SharedPool<r2d2_postgres::PostgresConnectionManager<tokio_postgres::tls::NoTls>>>>
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  26: core::ptr::drop_in_place<r2d2::Pool<r2d2_postgres::PostgresConnectionManager<tokio_postgres::tls::NoTls>>>
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  27: r2d2::config::Builder<M>::build
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/r2d2-0.8.9/src/config.rs:230:5
  28: <postgres::client::Client as rocket_contrib::databases::poolable::Poolable>::pool
             at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/contrib/lib/src/databases/poolable.rs:178:12
  29: rocket_contrib::databases::connection::ConnectionPool<K,C>::fairing::{{closure}}::{{closure}}
             at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/contrib/lib/src/databases/connection.rs:80:19
  30: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  31: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:120:9
  32: <rocket::fairing::ad_hoc::AdHoc as rocket::fairing::Fairing>::on_ignite::{{closure}}
             at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/core/lib/src/fairing/ad_hoc.rs:239:41
  33: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  34: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:120:9
  35: rocket::fairing::fairings::Fairings::handle_ignite::{{closure}}
             at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/core/lib/src/fairing/fairings.rs:58:32
  36: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  37: rocket::rocket::Rocket<rocket::phase::Build>::ignite::{{closure}}
             at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/core/lib/src/rocket.rs:467:16
  38: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  39: rocket::rocket::Rocket<P>::local_launch::{{closure}}
             at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/core/lib/src/rocket.rs:792:32
  40: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  41: rocket::local::asynchronous::client::Client::_new::{{closure}}
             at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/core/lib/src/local/asynchronous/client.rs:61:22
  42: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  43: rocket::local::asynchronous::client::Client::tracked::{{closure}}
             at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/core/lib/src/local/client.rs:71:9
  44: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  45: rocket_bug_repro::test::test_get_entries::{{closure}}
             at ./src/main.rs:39:22
  46: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  47: tokio::park::thread::CachedParkThread::block_on::{{closure}}
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/park/thread.rs:263:54
  48: tokio::coop::with_budget::{{closure}}
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/coop.rs:106:9
  49: std::thread::local::LocalKey<T>::try_with
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:272:16
  50: std::thread::local::LocalKey<T>::with
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:248:9
  51: tokio::coop::with_budget
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/coop.rs:99:5
  52: tokio::coop::budget
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/coop.rs:76:5
  53: tokio::park::thread::CachedParkThread::block_on
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/park/thread.rs:263:31
  54: tokio::runtime::enter::Enter::block_on
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/enter.rs:151:13
  55: tokio::runtime::thread_pool::ThreadPool::block_on
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/thread_pool/mod.rs:71:9
  56: tokio::runtime::Runtime::block_on
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/mod.rs:452:43
  57: rocket::async_test
             at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/core/lib/src/lib.rs:186:5
  58: rocket_bug_repro::test::test_get_entries
             at ./src/main.rs:38:33
  59: rocket_bug_repro::test::test_get_entries::{{closure}}
             at ./src/main.rs:38:11
  60: core::ops::function::FnOnce::call_once
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
  61: core::ops::function::FnOnce::call_once
             at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::panicking::begin_panic
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:519:12
   1: tokio::runtime::enter::enter
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/enter.rs:39:9
   2: tokio::runtime::basic_scheduler::Inner<P>::block_on::{{closure}}
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/basic_scheduler.rs:203:26
   3: tokio::runtime::basic_scheduler::enter::{{closure}}
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/basic_scheduler.rs:323:29
   4: tokio::macros::scoped_tls::ScopedKey<T>::set
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/macros/scoped_tls.rs:61:9
   thread '5test::test_get_entries: ' panicked at 'tokioCannot start a runtime from within a runtime. This happens because a function (like `block_on`) attempted to block the current thread while the thread is being used to drive asynchronous tasks.::', runtime/home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/enter.rs:::basic_scheduler39:::enter9

             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/basic_scheduler.rs:323:5
   6: tokio::runtime::basic_scheduler::Inner<P>::block_on
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/basic_scheduler.rs:202:9
   7: tokio::runtime::basic_scheduler::InnerGuard<P>::block_on
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/basic_scheduler.rs:481:9
   8: tokio::runtime::basic_scheduler::BasicScheduler<P>::block_on
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/basic_scheduler.rs:162:24
   9: tokio::runtime::Runtime::block_on
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/mod.rs:450:46
  10: postgres::connection::Connection::poll_block_on
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/postgres-0.19.1/src/connection.rs:67:9
  11: postgres::client::Client::close_inner
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/postgres-0.19.1/src/client.rs:571:9
  12: <postgres::client::Client as core::ops::drop::Drop>::drop
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/postgres-0.19.1/src/client.rs:20:17
  13: core::ptr::drop_in_place<postgres::client::Client>
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  14: core::ptr::drop_in_place<r2d2::Conn<postgres::client::Client>>
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  15: core::ptr::drop_in_place<r2d2::IdleConn<postgres::client::Client>>
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  16: core::ptr::drop_in_place<[r2d2::IdleConn<postgres::client::Client>]>
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  17: <alloc::vec::Vec<T,A> as core::ops::drop::Drop>::drop
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs:2669:13
  18: core::ptr::drop_in_place<alloc::vec::Vec<r2d2::IdleConn<postgres::client::Client>>>
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  19: core::ptr::drop_in_place<r2d2::PoolInternals<postgres::client::Client>>
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  20: core::ptr::drop_in_place<core::cell::UnsafeCell<r2d2::PoolInternals<postgres::client::Client>>>
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  21: core::ptr::drop_in_place<lock_api::mutex::Mutex<parking_lot::raw_mutex::RawMutex,r2d2::PoolInternals<postgres::client::Client>>>
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  22: core::ptr::drop_in_place<r2d2::SharedPool<r2d2_postgres::PostgresConnectionManager<tokio_postgres::tls::NoTls>>>
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  23: alloc::sync::Arc<T>::drop_slow
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:1039:18
  24: <alloc::sync::Arc<T> as core::ops::drop::Drop>::drop
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:1571:13
  25: core::ptr::drop_in_place<alloc::sync::Arc<r2d2::SharedPool<r2d2_postgres::PostgresConnectionManager<tokio_postgres::tls::NoTls>>>>
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  26: core::ptr::drop_in_place<r2d2::Pool<r2d2_postgres::PostgresConnectionManager<tokio_postgres::tls::NoTls>>>
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  27: r2d2::config::Builder<M>::build
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/r2d2-0.8.9/src/config.rs:230:5
  28: <postgres::client::Client as rocket_contrib::databases::poolable::Poolable>::pool
             at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/contrib/lib/src/databases/poolable.rs:178:12
  29: rocket_contrib::databases::connection::ConnectionPool<K,C>::fairing::{{closure}}::{{closure}}
             at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/contrib/lib/src/databases/connection.rs:80:19
  30: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  31: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:120:9
  32: <rocket::fairing::ad_hoc::AdHoc as rocket::fairing::Fairing>::on_ignite::{{closure}}
             at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/core/lib/src/fairing/ad_hoc.rs:239:41
  33: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  34: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:120:9
  35: rocket::fairing::fairings::Fairings::handle_ignite::{{closure}}
             at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/core/lib/src/fairing/fairings.rs:58:32
  36: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  37: rocket::rocket::Rocket<rocket::phase::Build>::ignite::{{closure}}
             at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/core/lib/src/rocket.rs:467:16
  38: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  39: rocket::rocket::Rocket<P>::local_launch::{{closure}}
             at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/core/lib/src/rocket.rs:792:32
  40: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  41: rocket::local::asynchronous::client::Client::_new::{{closure}}
             at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/core/lib/src/local/asynchronous/client.rs:61:22
  42: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  43: rocket::local::asynchronous::client::Client::tracked::{{closure}}
             at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/core/lib/src/local/client.rs:71:9
  44: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  45: rocket_bug_repro::test::test_get_entries_4::{{closure}}
             at ./src/main.rs:84:22
  46: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  47: tokio::park::thread::CachedParkThread::block_on::{{closure}}
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/park/thread.rs:263:54
  48: tokio::coop::with_budget::{{closure}}
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/coop.rs:106:9
  49: std::thread::local::LocalKey<T>::try_with
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:272:16
  50: std::thread::local::LocalKey<T>::with
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:248:9
  51: tokio::coop::with_budget
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/coop.rs:99:5
  52: tokio::coop::budget
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/coop.rs:76:5
  53: tokio::park::thread::CachedParkThread::block_on
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/park/thread.rs:263:31
  54: tokio::runtime::enter::Enter::block_on
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/enter.rs:151:13
  55: tokio::runtime::thread_pool::ThreadPool::block_on
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/thread_pool/mod.rs:71:9
  56: tokio::runtime::Runtime::block_on
             at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/mod.rs:452:43
  57: rocket::async_test
             at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/core/lib/src/lib.rs:186:5
  58: rocket_bug_repro::test::test_get_entries_4
             at ./src/main.rs:83:35
  59: rocket_bug_repro::test::test_get_entries_4::{{closure}}
             at ./src/main.rs:83:11
  60: core::ops::function::FnOnce::call_once
             at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
  61: core::ops::function::FnOnce::call_once
             at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0:     0x561ccb0c53d0 - std::backtrace_rs::backtrace::libunwind::trace::hdcf4f90f85129e83
                               at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x561ccb0c53d0 - std::backtrace_rs::backtrace::trace_unsynchronized::h2669e30cb82f6732
                               at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x561ccb0c53d0 - std::sys_common::backtrace::_print_fmt::hfbda19e17f6db318
                               at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x561ccb0c53d0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1a8751bf59281272
       thread ' test::test_get_entries_4 ' panicked at ' Cannot start a runtime from within a runtime. This happens because a function (like `block_on`) attempted to block the current thread while the thread is being used to drive asynchronous tasks. ',  /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/enter.rs : 39 : 9 
              at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x561ccb0ea92f - core::fmt::write::h7aa6cd0067dca82a
                               at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/core/src/fmt/mod.rs:1094:17
   5:     0x561ccb0bf335 - std::io::Write::write_fmt::hd7dd3a1df9b6befb
                               at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/std/src/io/mod.rs:1580:15
   6:     0x561ccb0c761b - std::sys_common::backtrace::_print::h551e9ec8a9fa8106
                               at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x561ccb0c761b - std::sys_common::backtrace::print::ha4b1c5e95fa040b3
                               at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x561ccb0c761b - std::panicking::default_hook::{{closure}}::h0b34c9ab7fb9f857
                               at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/std/src/panicking.rs:208:50
   9:     0x561ccb0c70fd - std::panicking::default_hook::h3067e8318decd17a
                               at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/std/src/panicking.rs:225:9
  10:     0x561ccb0c7bcd - std::panicking::rust_panic_with_hook::h81b8facc50f34daa
                               at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/std/src/panicking.rs:591:17
  11:     0x561ccb097fd3 - std::panicking::begin_panic::{{closure}}::h99226beae825c61f
                               at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:520:9
  12:     0x561ccb09a579 - std::sys_common::backtrace::__rust_end_short_backtrace::hc49d860b1a6e3031
                               at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys_common/backtrace.rs:141:18
  13:     0x561ccb097f09 - std::panicking::begin_panic::h732e081b9c235d56
                               at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:519:12
  14:     0x561ccafe3ede - tokio::runtime::enter::enter::hc0f5c90ef5c894ad
                               at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/enter.rs:39:9
  15:     0x561ccab45bed - tokio::runtime::basic_scheduler::Inner<P>::block_on::{{closure}}::hed6681e77f9260cd
                               at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/basic_scheduler.rs:203:26
  16:     0x561ccab48082 - tokio::runtime::basic_scheduler::enter::{{closure}}::hd9457608416cbd0b
                               at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/basic_scheduler.rs:323:29
  17:     0x561ccab4ff95 - tokio::macros::scoped_tls::ScopedKey<T>::set::h57555c445c614f4c
                               at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/macros/scoped_tls.rs:61:9
  18:     0x561ccab47f1c - tokio::runtime::basic_scheduler::enter::hef3db5e04d965df2
                               at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/basic_scheduler.rs:323:5
  19:     0x561ccab4502e - tokio::runtime::basic_scheduler::Inner<P>::block_on::hfad4f04041f5977b
                               at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/basic_scheduler.rs:202:9
  20:     0x561ccab46ad7 - tokio::runtime::basic_scheduler::InnerGuard<P>::block_on::hf3db743b8bb44ae5
                               at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/basic_scheduler.rs:481:9
  21:     0x561ccab4722f - tokio::runtime::basic_scheduler::BasicScheduler<P>::block_on::h81317ea8947b6220
                               at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/basic_scheduler.rs:162:24
  22:     0x561ccab54411 - tokio::runtime::Runtime::block_on::hdd6afd6059619e36
                               at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/mod.rs:450:46
  23:     0x561ccab4ddae - postgres::connection::Connection::poll_block_on::h2679b483c50a915a
                               at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/postgres-0.19.1/src/connection.rs:67:9
  24:     0x561ccab502c6 - postgres::client::Client::close_inner::h47f6c2ca10d3bf4f
                               at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/postgres-0.19.1/src/client.rs:571:9
  25:     0x561ccab5015e - <postgres::client::Client as core::ops::drop::Drop>::drop::h8e8e91aabcfa4235
                               at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/postgres-0.19.1/src/client.rs:20:17
  26:     0x561ccab4be67 - core::ptr::drop_in_place<postgres::client::Client>::h1bb55a0ebc17bef6
                               at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  27:     0x561ccab05407 - core::ptr::drop_in_place<r2d2::Conn<postgres::client::Client>>::h1afb02d73042169b
                               at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  28:     0x561ccab055be - core::ptr::drop_in_place<r2d2::IdleConn<postgres::client::Client>>::hbdf9d190a0f0d1a2
                               at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  29:     0x561ccab05b30 - core::ptr::drop_in_place<[r2d2::IdleConn<postgres::client::Client>]>::h585788ba78b096b4
                               at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  30:     0x561ccaae96e5 - <alloc::vec::Vec<T,A> as core::ops::drop::Drop>::drop::h1014dbeaed67654c
                               at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs:2669:13
  31:     0x561ccab05e97 - core::ptr::drop_in_place<alloc::vec::Vec<r2d2::IdleConn<postgres::client::Client>>>::h8e2d4d122814968e
                               at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  32:     0x561ccab05777 - core::ptr::drop_in_place<r2d2::PoolInternals<postgres::client::Client>>::h2aa99339b8d8a7cd
                               at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  33:     0x561ccab02e0e - core::ptr::drop_in_place<core::cell::UnsafeCell<r2d2::PoolInternals<postgres::client::Client>>>::hc7a3400199edd9c3
                               at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  34:     0x561ccab03c32 - core::ptr::drop_in_place<lock_api::mutex::Mutex<parking_lot::raw_mutex::RawMutex,r2d2::PoolInternals<postgres::client::Client>>>::h9c597f639a3d14f0
                               at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  35:     0x561ccab03394 - core::ptr::drop_in_place<r2d2::SharedPool<r2d2_postgres::PostgresConnectionManager<tokio_postgres::tls::NoTls>>>::hfd20430b3a7ee999
                               at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  36:     0x561ccab022d4 - alloc::sync::Arc<T>::drop_slow::hab07dd6909c7be77
                               at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:1039:18
  37:     0x561ccab0275c - <alloc::sync::Arc<T> as core::ops::drop::Drop>::drop::h0d6edef0d36279b3
                               at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:1571:13
  38:     0x561ccab03d5e - core::ptr::drop_in_place<alloc::sync::Arc<r2d2::SharedPool<r2d2_postgres::PostgresConnectionManager<tokio_postgres::tls::NoTls>>>>::hf5479effd6eb21e6
                               at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  39:     0x561ccab0312e - core::ptr::drop_in_place<r2d2::Pool<r2d2_postgres::PostgresConnectionManager<tokio_postgres::tls::NoTls>>>::h8a7979ea6bcfc259
                               at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:192:1
  40:     0x561ccaafcbac - r2d2::config::Builder<M>::build::hfc571a12b6bd218d
                               at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/r2d2-0.8.9/src/config.rs:230:5
  41:     0x561ccab14fc2 - <postgres::client::Client as rocket_contrib::databases::poolable::Poolable>::pool::hb3198e4a077f798e
                               at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/contrib/lib/src/databases/poolable.rs:178:12
  42:     0x561ccaa799ff - rocket_contrib::databases::connection::ConnectionPool<K,C>::fairing::{{closure}}::{{closure}}::hdd1021a74bf0587d
                               at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/contrib/lib/src/databases/connection.rs:80:19
  43:     0x561ccaa83149 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hbafb64aece7b45e3
                               at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  44:     0x561ccad2ca99 - <core::pin::Pin<P> as core::future::future::Future>::poll::h2066fbf9a7a3729f
                               at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:120:9
  45:     0x561ccad15c90 - <rocket::fairing::ad_hoc::AdHoc as rocket::fairing::Fairing>::on_ignite::{{closure}}::h2fa4e16f5deb0435
                               at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/core/lib/src/fairing/ad_hoc.rs:239:41
  46:     0x561ccacfd1ca - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h54cd52d9a0afb3bf
                               at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  47:     0x561ccad2ca99 - <core::pin::Pin<P> as core::future::future::Future>::poll::h2066fbf9a7a3729f
                               at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:120:9
  48:     0x561ccac945a9 - rocket::fairing::fairings::Fairings::handle_ignite::{{closure}}::h98919c843c799273
                               at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/core/lib/src/fairing/fairings.rs:58:32
  49:     0x561ccacfd0b9 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h54c05b70c2e3b3cf
                               at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  50:     0x561ccace56d9 - rocket::rocket::Rocket<rocket::phase::Build>::ignite::{{closure}}::haab7214099777c25
                               at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/core/lib/src/rocket.rs:467:16
  51:     0x561ccacfcd8b - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h1d9e3a24272c9bb6
                               at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  52:     0x561ccace893f - rocket::rocket::Rocket<P>::local_launch::{{closure}}::h6aac57ee555053b5
                               at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/core/lib/src/rocket.rs:792:32
  53:     0x561ccacfcadb - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h0f9ebf422705a7ec
                               at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  54:     0x561ccad123d8 - rocket::local::asynchronous::client::Client::_new::{{closure}}::h6029e8c8e2d395de
                               at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/core/lib/src/local/asynchronous/client.rs:61:22
  55:     0x561ccacfe08b - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hfcf1d67ec7b4aa11
                               at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  56:     0x561ccaa8bf51 - rocket::local::asynchronous::client::Client::tracked::{{closure}}::h499f77b817f69787
                               at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/core/lib/src/local/client.rs:71:9
  57:     0x561ccaa834f9 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hd8dde10987b03c94
                               at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  58:     0x561ccaaa4b4f - rocket_bug_repro::test::test_get_entries_3::{{closure}}::h2be08d3c9fff5505
                               at /home/kittyandrew/tmp/rocket-bug-repro/src/main.rs:69:22
  59:     0x561ccaa82f2b - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::ha3dc499a82453b1d
                               at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
  60:     0x561ccaa804a0 - tokio::park::thread::CachedParkThread::block_on::{{closure}}::h32a9958efd59451f
                               at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/park/thread.rs:263:54
  61:     0x561ccaa6e16c - tokio::coop::with_budget::{{closure}}::h1554505db69c92e4
                               at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/coop.rs:106:9
  62:     0x561ccaa8961c - std::thread::local::LocalKey<T>::try_with::h8f0f1614611a655e
                               at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:272:16
  63:     0x561ccaa877ed - std::thread::local::LocalKey<T>::with::h26fc928251fc5cd4
                               at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:248:9
  64:     0x561ccaa7d37c - tokio::coop::with_budget::h90cf53eebfb7f247
                               at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/coop.rs:99:5
  65:     0x561ccaa7d37c - tokio::coop::budget::h6d27ebaa1d091a66
                               at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/coop.rs:76:5
  66:     0x561ccaa7d37c - tokio::park::thread::CachedParkThread::block_on::h469932602e9e9e5d
                               at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/park/thread.rs:263:31
  67:     0x561ccaa9043a - tokio::runtime::enter::Enter::block_on::h1b93cc8f42a1625e
                               at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/enter.rs:151:13
  68:     0x561ccaa8cc4f - tokio::runtime::thread_pool::ThreadPool::block_on::hbc328ca743e6a69f
                               at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/thread_pool/mod.rs:71:9
  69:     0x561ccaaa7151 - tokio::runtime::Runtime::block_on::hd0d31e0970912a9a
                               at /home/kittyandrew/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.5.0/src/runtime/mod.rs:452:43
  70:     0x561ccaaa1b6d - rocket::async_test::hefe06e8a7a83cbea
                               at /home/kittyandrew/.cargo/git/checkouts/rocket-8bf16d9ca7e90bdc/e1307dd/core/lib/src/lib.rs:186:5
  71:     0x561ccaaa07e9 - rocket_bug_repro::test::test_get_entries_3::h42b6aa7705e4d9ec
                               at /home/kittyandrew/tmp/rocket-bug-repro/src/main.rs:68:35
  72:     0x561ccaaa44dd - rocket_bug_repro::test::test_get_entries_3::{{closure}}::hd4ad733578b0f10c
                               at /home/kittyandrew/tmp/rocket-bug-repro/src/main.rs:68:11
  73:     0x561ccaa846ee - core::ops::function::FnOnce::call_once::hc79e620082f0803a
                               at /home/kittyandrew/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
  74:     0x561ccaaceab6 - core::ops::function::FnOnce::call_once::h4e9353104004bc3d
                               at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/core/src/ops/function.rs:227:5
  75:     0x561ccaaceab6 - test::__rust_begin_short_backtrace::hea4fd7fe7fb8303e
                               at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/test/src/lib.rs:576:5
  76:     0x561ccaacd516 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hd7fd3e88849fc750
                               at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/alloc/src/boxed.rs:1546:9
  77:     0x561ccaacd516 - <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h78a6897906b26c6e
                               at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/std/src/panic.rs:344:9
  78:     0x561ccaacd516 - std::panicking::try::do_call::hbaa9991bef154d76
                               at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/std/src/panicking.rs:379:40
  79:     0x561ccaacd516 - std::panicking::try::h0d1e876a7e6d9927
                               at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/std/src/panicking.rs:343:19
  80:     0x561ccaacd516 - std::panic::catch_unwind::hf9cfc8afbc70b84f
                               at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/std/src/panic.rs:431:14
  81:     0x561ccaacd516 - test::run_test_in_process::h947bacbaa4554ce4
                               at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/test/src/lib.rs:599:18
  82:     0x561ccaacd516 - test::run_test::run_test_inner::{{closure}}::he92bab8f95bf0784
                               at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/test/src/lib.rs:491:39
  83:     0x561ccaaa895e - test::run_test::run_test_inner::{{closure}}::hf54209f3d25efeee
                               at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/test/src/lib.rs:518:37
  84:     0x561ccaaa895e - std::sys_common::backtrace::__rust_begin_short_backtrace::hd6d5206cf37fd269
                               at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/std/src/sys_common/backtrace.rs:125:18
  85:     0x561ccaaac678 - std::thread::Builder::spawn_unchecked::{{closure}}::{{closure}}::h13bbfbf02991444a
                               at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/std/src/thread/mod.rs:474:17
  86:     0x561ccaaac678 - <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h0e73313fa1b917d2
                               at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/std/src/panic.rs:344:9
  87:     0x561ccaaac678 - std::panicking::try::do_call::h0601c6cdea59af51
                               at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/std/src/panicking.rs:379:40
  88:     0x561ccaaac678 - std::panicking::try::h0d9ec6a2b7f348d3
                               at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/std/src/panicking.rs:343:19
  89:     0x561ccaaac678 - std::panic::catch_unwind::h5b95c4a8cef23017
                               at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/std/src/panic.rs:431:14
  90:     0x561ccaaac678 - std::thread::Builder::spawn_unchecked::{{closure}}::hbfc50e47df131303
                               at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/std/src/thread/mod.rs:473:30
  91:     0x561ccaaac678 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h5a3a0711c63b5a79
                               at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/core/src/ops/function.rs:227:5
  92:     0x561ccb0cdb37 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3aa31cb6360b59d9
                               at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/alloc/src/boxed.rs:1546:9
  93:     0x561ccb0cdb37 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h7719d3c7c5841461
                               at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/alloc/src/boxed.rs:1546:9
  94:     0x561ccb0cdb37 - std::sys::unix::thread::Thread::new::thread_start::hfbe13ead469fd0bc
                               at /rustc/16bf626a31cb5b121d0bca2baa969b4f67eb0dab/library/std/src/sys/unix/thread.rs:71:17
  95:     0x7fbea4d15590 - start_thread
  96:     0x7fbea4ae6223 - clone
  97:                0x0 - <unknown>
thread panicked while panicking. aborting.
stack backtrace:
error: test failed, to rerun pass '--bin rocket-bug-repro'

Caused by:
  process didn't exit successfully: `/home/kittyandrew/tmp/rocket-bug-repro/target/debug/deps/rocket_bug_repro-dc4482a295a94d90 --nocapture` (signal: 4, SIGILL: illegal instruction)
```

</details>
Okay, I am reproducing a similar error.

I get: `db error: FATAL: remaining connection slots are reserved for non-replication superuser connections`
The problem here is that the "obvious" way to arrange tests tries to open more simultaneous connections the more tests there are, causing a deadlock during initialization that is broken by a timeout. Limiting the number of concurrent tests with `cargo test -- --test-threads` fixes this problem for me, and so does setting `pool_size = 1` (at least, until there are too many tests again). The technique used by the `todo` example ( <https://github.com/SergioBenitez/Rocket/blob/e1307ddf48dac14e6a37e526098732327bcb86f0/examples/todo/src/tests.rs#L11>) is another alternative that should accomplish the same.

After this error occurs, the pool is `Drop`ped from `async` code. This wasn't noticed or fixed as part of c6298b9 because this case happens before it is wrapped into the `Drop`-safe wrapper type and needs to be fixed separately.
> get: `db error: FATAL: remaining connection slots are reserved for non-replication superuser connections`
> The problem here is that the "obvious" way to arrange tests tries to open more simultaneous connections the more tests there are, causing a deadlock during initialization that is broken by a timeout.

I'm confused by what you're implying, if anything. Are you saying this is something that can't be fixed in Rocket, or are you suggesting what the new issue is?
There are two problems shown by the output in <https://github.com/SergioBenitez/Rocket/issues/1610#issuecomment-824446271>:

* Postgres limits the number of incoming connections, and running too many tests simultaneously, each with their own pool of open connections, appears to hit that limit. One solution is to have fewer simultaneous open connections, and the easiest way I know of to do this is to limit concurrent tests with `test-threads` or with the approach used in the `todo` example. Rocket *may* be able to mitigate this, but I can't think of an elegant way to do that because it's entirely application-dependent how many tests are connecting to which database at which capacity and whether that exceeds some limit.

* Errors during pool initialization *should* only be printed, but it leads to panics at least in `postgres` due to a missing call to `spawn_blocking`. This is similar to the case fixed by c6298b9, but that commit only covered the "happy path" and not the case where the synchronous connection pool might be dropped before/instead of being placed into its `Drop`-fixing wrapper. It's thankfully not hard to fix:

```diff
diff --git a/contrib/lib/src/databases/connection.rs b/contrib/lib/src/databases/connection.rs
index 0f698701..ad07cb6a 100644
--- a/contrib/lib/src/databases/connection.rs
+++ b/contrib/lib/src/databases/connection.rs
@@ -71,6 +71,7 @@ macro_rules! dberr {
 impl<K: 'static, C: Poolable> ConnectionPool<K, C> {
     pub fn fairing(fairing_name: &'static str, db: &'static str) -> impl Fairing {
         AdHoc::try_on_ignite(fairing_name, move |rocket| async move {
+            run_blocking(move || {
                 let config = match Config::from(db, &rocket) {
                     Ok(config) => config,
                     Err(e) => dberr!("config", db, "{}", e, rocket),
@@ -88,6 +89,7 @@ impl<K: 'static, C: Poolable> ConnectionPool<K, C> {
                     Err(Error::Pool(e)) => dberr!("pool init", db, "{}", e, rocket),
                     Err(Error::Custom(e)) => dberr!("pool manager", db, "{:?}", e, rocket),
                 }
+            }).await
         })
     }
```

Note that this was "wrong" for a long time, because it ran synchronous code on a thread currently running asynchronous code. However, currently only `postgres` pools `Drop`ping reliably detect and panic when this happens, because it indirectly leads to recursive calls to tokio's `block_on`. Synchronous databases that don't have an asynchronous I/O backend would silently block anywawy, which... honestly during startup/shutdown is probably not the end of the world, but it's relatively easy and correct to fix this everywhere. I'll open the PR once I'm sure there isn't another missing `blocking` call for one of these.

Fix patch:
diff --git a/contrib/lib/Cargo.toml b/contrib/lib/Cargo.toml
index 89fa68871d..b8d144b134 100644
--- a/contrib/lib/Cargo.toml
+++ b/contrib/lib/Cargo.toml
@@ -42,7 +42,7 @@ diesel_mysql_pool = ["databases", "diesel/mysql", "diesel/r2d2"]
 
 [dependencies]
 # Global dependencies.
-tokio = { version = "1.0", optional = true }
+tokio = { version = "1.4", optional = true }
 rocket_contrib_codegen = { version = "0.5.0-dev", path = "../codegen", optional = true }
 rocket = { version = "0.5.0-dev", path = "../../core/lib/", default-features = false }
 log = "0.4"
diff --git a/contrib/lib/src/databases/connection.rs b/contrib/lib/src/databases/connection.rs
index 0f698701b7..8d321b6161 100644
--- a/contrib/lib/src/databases/connection.rs
+++ b/contrib/lib/src/databases/connection.rs
@@ -71,23 +71,25 @@ macro_rules! dberr {
 impl<K: 'static, C: Poolable> ConnectionPool<K, C> {
     pub fn fairing(fairing_name: &'static str, db: &'static str) -> impl Fairing {
         AdHoc::try_on_ignite(fairing_name, move |rocket| async move {
-            let config = match Config::from(db, &rocket) {
-                Ok(config) => config,
-                Err(e) => dberr!("config", db, "{}", e, rocket),
-            };
-
-            let pool_size = config.pool_size;
-            match C::pool(db, &rocket) {
-                Ok(pool) => Ok(rocket.manage(ConnectionPool::<K, C> {
-                    config,
-                    pool: Some(pool),
-                    semaphore: Arc::new(Semaphore::new(pool_size as usize)),
-                    _marker: PhantomData,
-                })),
-                Err(Error::Config(e)) => dberr!("config", db, "{}", e, rocket),
-                Err(Error::Pool(e)) => dberr!("pool init", db, "{}", e, rocket),
-                Err(Error::Custom(e)) => dberr!("pool manager", db, "{:?}", e, rocket),
-            }
+            run_blocking(move || {
+                let config = match Config::from(db, &rocket) {
+                    Ok(config) => config,
+                    Err(e) => dberr!("config", db, "{}", e, rocket),
+                };
+
+                let pool_size = config.pool_size;
+                match C::pool(db, &rocket) {
+                    Ok(pool) => Ok(rocket.manage(ConnectionPool::<K, C> {
+                        config,
+                        pool: Some(pool),
+                        semaphore: Arc::new(Semaphore::new(pool_size as usize)),
+                        _marker: PhantomData,
+                    })),
+                    Err(Error::Config(e)) => dberr!("config", db, "{}", e, rocket),
+                    Err(Error::Pool(e)) => dberr!("pool init", db, "{}", e, rocket),
+                    Err(Error::Custom(e)) => dberr!("pool manager", db, "{:?}", e, rocket),
+                }
+            }).await
         })
     }
 
@@ -158,7 +160,10 @@ impl<K: 'static, C: Poolable> Connection<K, C> {
         run_blocking(move || {
             // And then re-enter the runtime to wait on the async mutex, but in
             // a blocking fashion.
-            let mut connection = tokio::runtime::Handle::current().block_on(async { connection.lock_owned().await });
+            let mut connection = tokio::runtime::Handle::current().block_on(async {
+                connection.lock_owned().await
+            });
+
             let conn = connection.as_mut()
                 .expect("internal invariant broken: self.connection is Some");
             f(conn)
@@ -173,7 +178,10 @@ impl<K, C: Poolable> Drop for Connection<K, C> {
 
         // See same motivation above for this arrangement of spawn_blocking/block_on
         tokio::task::spawn_blocking(move || {
-            let mut connection = tokio::runtime::Handle::current().block_on(async { connection.lock_owned().await });
+            let mut connection = tokio::runtime::Handle::current().block_on(async {
+                connection.lock_owned().await
+            });
+
             if let Some(conn) = connection.take() {
                 drop(conn);
             }


Test patch: