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

thread 'main' panicked at 'split_to out of bounds: 4 <= 1', on OSX 10.5.14 #17

Closed
hlzhang opened this issue May 15, 2020 · 0 comments · Fixed by #20
Closed

thread 'main' panicked at 'split_to out of bounds: 4 <= 1', on OSX 10.5.14 #17

hlzhang opened this issue May 15, 2020 · 0 comments · Fixed by #20

Comments

@hlzhang
Copy link

hlzhang commented May 15, 2020

Mac OSX 10.5.14

Cargo.toml

...
rust-tun ={ version = "0.5.0", , features = ["async"] }
futures = "0.3.1"
tokio = { version = "0.2", features = ["full"]}
tokio-util = { version = "0.3", features = ["codec", "udp"]}
...
thread 'main' panicked at 'split_to out of bounds: 4 <= 1', /Users/user/.cargo/registry/src/github.com-1ecc6299db9ec823/bytes-0.5.4/src/bytes_mut.rs:352:9
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:84
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:61
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1025
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1426
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:65
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:50
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:193
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:210
  10: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:471
  11: rust_begin_unwind
             at src/libstd/panicking.rs:375
  12: core::panicking::panic_fmt
             at src/libcore/panicking.rs:84
  13: bytes::bytes_mut::BytesMut::split_to
             at /Users/user/.cargo/registry/src/github.com-1ecc6299db9ec823/bytes-0.5.4/src/bytes_mut.rs:352
  14: <tun::async::codec::TunPacketCodec as tokio_util::codec::decoder::Decoder>::decode
             at /Users/user/CLionProjects/rust-tun/src/async/codec.rs:106
  15: <tokio_util::codec::framed_read::FramedRead2<T> as futures_core::stream::Stream>::poll_next
             at /Users/user/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-util-0.3.1/src/codec/framed_read.rs:269
  16: <tokio_util::codec::framed::Framed<T,U> as futures_core::stream::Stream>::poll_next
             at /Users/user/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-util-0.3.1/src/codec/framed.rs:257
  17: <futures_util::stream::stream::split::SplitStream<S> as futures_core::stream::Stream>::poll_next
             at /Users/user/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.5/src/stream/stream/split.rs:31
  18: futures_util::stream::stream::StreamExt::poll_next_unpin
             at /Users/user/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.5/src/stream/stream/mod.rs:1323
  19: <futures_util::stream::stream::next::Next<St> as core::future::future::Future>::poll
             at /Users/user/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.5/src/stream/stream/next.rs:35
  20: std::future::poll_with_tls_context
             at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libstd/future.rs:99
...

When I was doing something like this

let framed: FramedTunQueue = tun_queue.into_framed();
let (mut tun_sink, mut tun_stream) = framed.split();
while let Some(tun_pkt) = tun_stream.next().await {... // panic at this line
@meh meh closed this as completed in #20 Aug 13, 2020
zonyitoo pushed a commit to zonyitoo/rust-tun that referenced this issue Feb 18, 2024
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

Successfully merging a pull request may close this issue.

1 participant