Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection panics on drop #48

Closed
icefoxen opened this issue Oct 5, 2018 · 1 comment
Closed

Connection panics on drop #48

icefoxen opened this issue Oct 5, 2018 · 1 comment

Comments

@icefoxen
Copy link
Contributor

icefoxen commented Oct 5, 2018

I'm trying to make a unit test for a thing that runs a server, starts a client to talk to it, and then shuts down. For some reason the client panics on an Option::unwrap() deep in quinn when it is dropped and it tries to close the connection. When I run basically the same thing as a standalone program it appears to work? It might just not even attempt to shut down correctly when I ctrl-C it.

This code was ported from quicr so I may be doing something wrong now that quicr allowed. I haven't cut it down to a minimal reproduction next but hope to soon; maybe you can suggest something while I do. The code is here: https://github.com/icefoxen/WorldDat/blob/7ee3babc58ea6e8584b7d1095c7c084a98140fb3/src/peer.rs#L276 , just run cargo test to reproduce.

Edit: oh yeah, adding the backtrace might help.

---- peer::tests::test_client_connection stdout ----
thread 'peer::tests::test_client_connection' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:345:21
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at libstd/sys_common/backtrace.rs:71
             at libstd/sys_common/backtrace.rs:59
   2: std::panicking::default_hook::{{closure}}
             at libstd/panicking.rs:211
   3: std::panicking::default_hook
             at libstd/panicking.rs:221
   4: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:475
   5: std::panicking::continue_panic_fmt
             at libstd/panicking.rs:390
   6: rust_begin_unwind
             at libstd/panicking.rs:325
   7: core::panicking::panic_fmt
             at libcore/panicking.rs:77
   8: core::panicking::panic
             at libcore/panicking.rs:52
   9: <core::option::Option<T>>::unwrap
             at /checkout/src/libcore/macros.rs:20
  10: quinn_proto::connection::Connection::make_close
             at /home/icefox/.cargo/registry/src/github.com-1ecc6299db9ec823/quinn-proto-0.1.0/src/connection.rs:2056
  11: quinn_proto::connection::Connection::close
             at /home/icefox/.cargo/registry/src/github.com-1ecc6299db9ec823/quinn-proto-0.1.0/src/connection.rs:2082
  12: quinn_proto::endpoint::Endpoint::close
             at /home/icefox/.cargo/registry/src/github.com-1ecc6299db9ec823/quinn-proto-0.1.0/src/endpoint.rs:934
  13: <quinn::ConnectionInner as core::ops::drop::Drop>::drop
             at /home/icefox/.cargo/registry/src/github.com-1ecc6299db9ec823/quinn-0.1.0/src/lib.rs:887
  14: core::ptr::drop_in_place
             at /checkout/src/libcore/ptr.rs:59
  15: core::ptr::drop_in_place
             at /checkout/src/libcore/ptr.rs:59
  16: core::ptr::drop_in_place
             at /checkout/src/libcore/ptr.rs:59
  17: core::ptr::drop_in_place
             at /checkout/src/libcore/ptr.rs:59
  18: core::ptr::drop_in_place
             at /checkout/src/libcore/ptr.rs:59
  19: core::ptr::drop_in_place
             at /checkout/src/libcore/ptr.rs:59
  20: core::ptr::drop_in_place
             at /checkout/src/libcore/ptr.rs:59
  21: core::ptr::drop_in_place
             at /checkout/src/libcore/ptr.rs:59
  22: core::ptr::drop_in_place
             at /checkout/src/libcore/ptr.rs:59
  23: core::ptr::drop_in_place
             at /checkout/src/libcore/ptr.rs:59
  24: core::ptr::drop_in_place
             at /checkout/src/libcore/ptr.rs:59
  25: core::mem::drop
             at /checkout/src/libcore/mem.rs:795
  26: tokio_current_thread::scheduler::release_node
             at /home/icefox/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-current-thread-0.1.3/src/scheduler.rs:386
  27: <tokio_current_thread::scheduler::Scheduler<U> as core::ops::drop::Drop>::drop
             at /home/icefox/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-current-thread-0.1.3/src/scheduler.rs:419
  28: core::ptr::drop_in_place
             at /checkout/src/libcore/ptr.rs:59
  29: core::ptr::drop_in_place
             at /checkout/src/libcore/ptr.rs:59
  30: core::ptr::drop_in_place
             at /checkout/src/libcore/ptr.rs:59
  31: core::ptr::drop_in_place
             at /checkout/src/libcore/ptr.rs:59
  32: worlddat::peer::tests::test_client_connection
             at src/peer.rs:290
  33: worlddat::__test::TESTS::{{closure}}
             at src/peer.rs:276
  34: core::ops::function::FnOnce::call_once
             at /checkout/src/libcore/ops/function.rs:223
  35: <F as alloc::boxed::FnBox<A>>::call_box
             at libtest/lib.rs:1451
             at /checkout/src/libcore/ops/function.rs:223
             at /checkout/src/liballoc/boxed.rs:642
  36: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:105

@icefoxen
Copy link
Contributor Author

icefoxen commented Oct 7, 2018

Huzzah!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant