We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I setup a very basic "echo" websocket server. When I connect and then close the connection, I get a panic.
Websocket client (javascript console in Chrome/Firefox)
let ws = new Websocket("ws://127.0.0.1/ws"); ws.close(); //if I call ws.close(1000) instead, everything works fine
The code that tries to read an error code and causes a panic is here: https://github.com/actix/actix-web/blob/v0.5.4/src/ws/mod.rs#L313
I see the exact same behavior in Chrome and Firefox. If I provide a status code to the close() method such as 1000, everything seems to work fine.
close()
I am running actix-web v0.5.4
v0.5.4
Relevant RFC notes (https://tools.ietf.org/html/rfc6455#page-41 section 7.1.5)
If this Close control frame contains no status code, _The WebSocket Connection Close Code_ is considered to be 1005.
Stacktrace
thread 'arbiter:"b333e870-835c-416a-8d36-1cd189cb731b":"actor"' panicked at 'assertion failed: 1 <= nbytes && nbytes <= 8 && nbytes <= buf.len()', /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/byteorder-1.2.2/src/lib.rs:1858:9 stack backtrace: 0: 0x5562ec72d18f - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::h2fb330a06456ac7e at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49 1: 0x5562ec7328d0 - std::sys_common::backtrace::print::hf6ccec7cfd12ed67 at libstd/sys_common/backtrace.rs:71 at libstd/sys_common/backtrace.rs:59 2: 0x5562ec71f663 - std::panicking::default_hook::{{closure}}::h464de9af91e4ca8e at libstd/panicking.rs:205 3: 0x5562ec71f3ed - std::panicking::default_hook::hcde1a6167c711c5f at libstd/panicking.rs:221 4: 0x5562ec71fbea - std::panicking::rust_panic_with_hook::h8dcdd9a7e80a2917 at libstd/panicking.rs:457 5: 0x5562ec6e04c7 - std::panicking::begin_panic::h657bd638087f2a51 at /checkout/src/libstd/panicking.rs:391 6: 0x5562ec06b7bd - <byteorder::BigEndian as byteorder::ByteOrder>::read_uint::hc4d82996b5920a0a at /home/nathan/repos/athena/server/<panic macros>:3 7: 0x5562ec0dc601 - <actix_web::ws::WsStream<S> as futures::stream::Stream>::poll::h1bfaa5931f2c1be7 at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/actix-web-0.5.4/src/ws/mod.rs:313 8: 0x5562ec13ca34 - <actix::stream::ActorStream<A, M, E, S> as actix::fut::ActorFuture>::poll::h12a83978e9c671e7 at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/actix-0.5.6/src/stream.rs:140 9: 0x5562ec0b7394 - <alloc::boxed::Box<F> as actix::fut::ActorFuture>::poll::heefe305914f9026f at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/actix-0.5.6/src/fut/mod.rs:275 10: 0x5562ec097d5a - <actix::contextimpl::ContextImpl<A>>::poll::hdb936d20ac7d4c9f at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/actix-0.5.6/src/contextimpl.rs:300 11: 0x5562ec0c4d76 - <actix_web::ws::context::WebsocketContext<A, S> as actix_web::context::ActorHttpContext>::poll::hf481945d9b3d87cb at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/actix-web-0.5.4/src/ws/context.rs:230 12: 0x5562ec0edead - <actix_web::pipeline::ProcessResponse<S, H>>::poll_io::hc893dbfcfb40d262 at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/actix-web-0.5.4/src/pipeline.rs:560 13: 0x5562ec0e84a4 - <actix_web::pipeline::Pipeline<S, H> as actix_web::server::HttpHandlerTask>::poll_io::hb17759a43576fde6 at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/actix-web-0.5.4/src/pipeline.rs:168 14: 0x5562ec0376e4 - <actix_web::server::h1::Http1<T, H>>::poll_io::heffa1d17ebc130e9 at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/actix-web-0.5.4/src/server/h1.rs:230 15: 0x5562ec0365ca - <actix_web::server::h1::Http1<T, H>>::poll::h7ba69f02ae51904c at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/actix-web-0.5.4/src/server/h1.rs:123 16: 0x5562ec0c5f73 - <actix_web::server::channel::HttpChannel<T, H> as futures::future::Future>::poll::h955e5572b4c4f566 at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/actix-web-0.5.4/src/server/channel.rs:111 17: 0x5562ec3cc7b4 - <alloc::boxed::Box<F> as futures::future::Future>::poll::hf08db0d1ef793131 at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.21/src/future/mod.rs:113 18: 0x5562ec3cb8c4 - <futures::task_impl::Spawn<T>>::poll_future_notify::{{closure}}::hd3270683949965f5 at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.21/src/task_impl/mod.rs:289 19: 0x5562ec3cbdaa - <futures::task_impl::Spawn<T>>::enter::{{closure}}::had626c5b5de981d1 at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.21/src/task_impl/mod.rs:363 20: 0x5562ec3d1ba8 - futures::task_impl::std::set::h6dd896a31c54ca44 at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.21/src/task_impl/std/mod.rs:78 21: 0x5562ec3cbaca - <futures::task_impl::Spawn<T>>::enter::h25bf01acf2a11dd6 at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.21/src/task_impl/mod.rs:363 22: 0x5562ec3cb7a9 - <futures::task_impl::Spawn<T>>::poll_future_notify::h56e8c26c8b4901e1 at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.21/src/task_impl/mod.rs:289 23: 0x5562ec3c76e3 - <tokio::executor::current_thread::scheduler::Scheduled<'a, U>>::tick::h6dd128980d7ba529 at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.1.5/src/executor/current_thread/scheduler.rs:343 24: 0x5562ec3c74ec - <tokio::executor::current_thread::scheduler::Scheduler<U>>::tick::{{closure}}::h2cc1e2458cfbdf43 at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.1.5/src/executor/current_thread/scheduler.rs:323 25: 0x5562ec3bf8dc - <tokio::executor::current_thread::Borrow<'a, U>>::enter::{{closure}}::{{closure}}::hba0b4e24dc97b874 at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.1.5/src/executor/current_thread/mod.rs:657 26: 0x5562ec3bf30f - tokio::executor::current_thread::CurrentRunner::set_spawn::hb2d59aec2bdcd254 at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.1.5/src/executor/current_thread/mod.rs:689 27: 0x5562ec3bf7ec - <tokio::executor::current_thread::Borrow<'a, U>>::enter::{{closure}}::h1c4ddd6fc6e7b329 at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.1.5/src/executor/current_thread/mod.rs:656 28: 0x5562ec3bd341 - <std::thread::local::LocalKey<T>>::try_with::h3b7065649e239449 at /checkout/src/libstd/thread/local.rs:294 29: 0x5562ec3bcb84 - <std::thread::local::LocalKey<T>>::with::h3f76dec9d9fd7252 at /checkout/src/libstd/thread/local.rs:248 30: 0x5562ec3bf78a - <tokio::executor::current_thread::Borrow<'a, U>>::enter::hc898a990dfecb547 at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.1.5/src/executor/current_thread/mod.rs:655 31: 0x5562ec3c73df - <tokio::executor::current_thread::scheduler::Scheduler<U>>::tick::hd53149ed9baa4d28 at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.1.5/src/executor/current_thread/scheduler.rs:323 32: 0x5562ec3bf9bd - <tokio::executor::current_thread::Entered<'a, P>>::tick::hbfb92e9e7fdf18bb at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.1.5/src/executor/current_thread/mod.rs:541 33: 0x5562ec3bfaa6 - <tokio::executor::current_thread::Entered<'a, P>>::turn::h864f82a7636591b5 at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.1.5/src/executor/current_thread/mod.rs:493 34: 0x5562ec3c3445 - tokio_core::reactor::Core::poll::{{closure}}::{{closure}}::{{closure}}::{{closure}}::he3607acfb125f735 at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-core-0.1.17/src/reactor/mod.rs:298 35: 0x5562ec3b8adf - <scoped_tls::ScopedKey<T>>::set::h5264992d8e100b2b at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-0.1.1/src/lib.rs:155 36: 0x5562ec3c3881 - tokio_core::reactor::Core::poll::{{closure}}::{{closure}}::{{closure}}::h066a0b1df5e29f50 at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-core-0.1.17/src/reactor/mod.rs:297 37: 0x5562ec3c99a8 - tokio_timer::timer::handle::with_default::{{closure}}::haba1e39a5b5895c1 at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-timer-0.2.1/src/timer/handle.rs:64 38: 0x5562ec3bcf69 - <std::thread::local::LocalKey<T>>::try_with::h31aedc8adfdd53b6 at /checkout/src/libstd/thread/local.rs:294 39: 0x5562ec3bcd5a - <std::thread::local::LocalKey<T>>::with::hbed63daacbb213ce at /checkout/src/libstd/thread/local.rs:248 40: 0x5562ec3c9867 - tokio_timer::timer::handle::with_default::h8340bc671b311dbe at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-timer-0.2.1/src/timer/handle.rs:56 41: 0x5562ec3c4169 - tokio_core::reactor::Core::poll::{{closure}}::{{closure}}::h46e132fe1e1456d5 at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-core-0.1.17/src/reactor/mod.rs:275 42: 0x5562ec3c790c - tokio_executor::global::with_default::{{closure}}::hf1a7546efa7089ab at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-executor-0.1.2/src/global.rs:176 43: 0x5562ec3bd760 - <std::thread::local::LocalKey<T>>::try_with::h4ec12def4e4ada3e at /checkout/src/libstd/thread/local.rs:294 44: 0x5562ec3bcb3a - <std::thread::local::LocalKey<T>>::with::h03bc055913c5a571 at /checkout/src/libstd/thread/local.rs:248 45: 0x5562ec3c77c4 - tokio_executor::global::with_default::hb0ceda9b4632bb83 at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-executor-0.1.2/src/global.rs:150 46: 0x5562ec3c41b0 - tokio_core::reactor::Core::poll::{{closure}}::h029620064264082c at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-core-0.1.17/src/reactor/mod.rs:274 47: 0x5562ec3c9c2c - tokio_reactor::with_default::{{closure}}::hd105cea23c9bf3e8 at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-reactor-0.1.1/src/lib.rs:207 48: 0x5562ec3bdd70 - <std::thread::local::LocalKey<T>>::try_with::h9d30eaaa56b1cbc1 at /checkout/src/libstd/thread/local.rs:294 49: 0x5562ec3bcc9a - <std::thread::local::LocalKey<T>>::with::h8399193f3b483246 at /checkout/src/libstd/thread/local.rs:248 50: 0x5562ec3c9ac1 - tokio_reactor::with_default::h096e034e08bcbdae at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-reactor-0.1.1/src/lib.rs:199 51: 0x5562ec3c3282 - tokio_core::reactor::Core::poll::h3095c4ecc729710d at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-core-0.1.17/src/reactor/mod.rs:273 52: 0x5562ec23e1f3 - tokio_core::reactor::Core::run::h3865aef3c0877408 at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-core-0.1.17/src/reactor/mod.rs:248 53: 0x5562ec010559 - actix::arbiter::Arbiter::new::{{closure}}::hf1b43519e59c834e at /home/nathan/.cargo/registry/src/github.com-1ecc6299db9ec823/actix-0.5.6/src/arbiter.rs:95 54: 0x5562ec1410d4 - std::sys_common::backtrace::__rust_begin_short_backtrace::h3e09f5a8e49b591b at /checkout/src/libstd/sys_common/backtrace.rs:136 55: 0x5562ec01da0b - std::thread::Builder::spawn::{{closure}}::{{closure}}::h40e040e044c55f46 at /checkout/src/libstd/thread/mod.rs:409 56: 0x5562ec0e6874 - <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h003f6c4621d2303b at /checkout/src/libstd/panic.rs:296 57: 0x5562ec08fa54 - std::panicking::try::do_call::hf7b905cb3ff44116 at /checkout/src/libstd/panicking.rs:304 58: 0x5562ec739a1e - __rust_maybe_catch_panic at libpanic_unwind/lib.rs:105 59: 0x5562ec08f709 - std::panicking::try::h0d7f12416d848691 at /checkout/src/libstd/panicking.rs:283 60: 0x5562ec0e6984 - std::panic::catch_unwind::hfe29caf10e72aca7 at /checkout/src/libstd/panic.rs:361 61: 0x5562ec01d7c8 - std::thread::Builder::spawn::{{closure}}::h994ee66de05cf000 at /checkout/src/libstd/thread/mod.rs:408 62: 0x5562ec01daf5 - <F as alloc::boxed::FnBox<A>>::call_box::hc7ed55469dd70704 at /checkout/src/liballoc/boxed.rs:637 63: 0x5562ec72e8e7 - std::sys_common::thread::start_thread::h4a77c2e692e25ce6 at /checkout/src/liballoc/boxed.rs:647 at libstd/sys_common/thread.rs:24 64: 0x5562ec720128 - std::sys::unix::thread::Thread::new::thread_start::h5c4ff67e1691aab6 at libstd/sys/unix/thread.rs:90 65: 0x7f9dd2cd57fb - start_thread 66: 0x7f9dd27ebb5e - clone 67: 0x0 - <unknown>
The text was updated successfully, but these errors were encountered:
I am working on a PR to fix this
Sorry, something went wrong.
Thanks!
Successfully merging a pull request may close this issue.
I setup a very basic "echo" websocket server. When I connect and then close the connection, I get a panic.
Websocket client (javascript console in Chrome/Firefox)
The code that tries to read an error code and causes a panic is here: https://github.com/actix/actix-web/blob/v0.5.4/src/ws/mod.rs#L313
I see the exact same behavior in Chrome and Firefox. If I provide a status code to the
close()
method such as 1000, everything seems to work fine.I am running actix-web
v0.5.4
Relevant RFC notes (https://tools.ietf.org/html/rfc6455#page-41 section 7.1.5)
Stacktrace
The text was updated successfully, but these errors were encountered: