erebe / wstunnel

Tunnel all your traffic over Websocket or HTTP2 - Bypass firewalls/DPI - Static binary available
Other
3.22k stars 290 forks source link

arm64 build crashes on socks5 mode #175

Closed mikeliang closed 6 months ago

mikeliang commented 6 months ago

Describe the bug When using the wstunnel v7.6.0 arm64 build on a raspberry pi 4B box, crash randomly while access google.com.

023-10-28T15:27:04.473543Z  INFO tunnel{id="018b76e5-5a70-7194-9d1a-6c8a8aff414a" remote="encrypted-tbn0.gstatic.com:443"}: wstunnel::tunnel::io: Closing local tx ==> websocket tx tunnel
2023-10-28T15:27:04.473750Z  INFO tunnel{id="018b76e5-5a70-7194-9d1a-6c8a8aff414a" remote="encrypted-tbn0.gstatic.com:443"}: wstunnel::tunnel::io: Closing local rx <== websocket rx tunnel
2023-10-28T15:27:05.130702Z  INFO wstunnel::tcp: Opening TCP connection to remote.example.com:8443
2023-10-28T15:27:05.213083Z  INFO wstunnel::tls: Doing TLS handshake using sni DnsName("remote.example.com") with the server remote.example.com:8443
thread 'tokio-runtime-worker' panicked at /cargo/git/checkouts/fastwebsockets-0824f4774dd6468b/6433d9d/src/lib.rs:680:58:
called `Result::unwrap()` on an `Err` value: TryFromSliceError(())
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Aborted

To Reproduce Steps to reproduce the behavior:

Expected behavior Works.

Screenshots If applicable, add screenshots to help explain your problem.

image

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

erebe commented 6 months ago

Would you mind trying the latest release and let me know the outcome (I bumped the websocket lib) ? https://github.com/erebe/wstunnel/releases/tag/v7.7.2

Also, if the issue persists, would you mind sharing the stack trace with the client stated with RUST_BACKTRACE=1 environment variable set.

mikeliang commented 6 months ago

Start with RUST_BACKTRACE=full, and access this link through the proxy:

The url causing crash

The output:

thread 'tokio-runtime-worker' panicked at /cargo/git/checkouts/fastwebsockets-0824f4774dd6468b/c4c0782/src/lib.rs:688:58:
called `Result::unwrap()` on an `Err` value: TryFromSliceError(())
stack backtrace:
   0:   0x2cc050 - std::backtrace_rs::backtrace::libunwind::trace::hbda7906e29861a5c
                       at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:   0x2cc050 - std::backtrace_rs::backtrace::trace_unsynchronized::h01822801e5e4fbb0
                       at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:   0x2cc050 - std::sys_common::backtrace::_print_fmt::he93c259285bba62a
                       at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/sys_common/backtrace.rs:67:5
   3:   0x2cc050 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h524ebf259c127cb3
                       at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/sys_common/backtrace.rs:44:22
   4:   0x16e36c - core::fmt::rt::Argument::fmt::h06f05059184e9d00
                       at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/fmt/rt.rs:138:9
   5:   0x16e36c - core::fmt::write::h8736ddf154da0400
                       at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/fmt/mod.rs:1094:21
   6:   0x2a0674 - std::io::Write::write_fmt::h5cc182e8cfc99e1b
                       at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/io/mod.rs:1714:15
   7:   0x2cd3d4 - std::sys_common::backtrace::_print::h2be5de7c745243ce
                       at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/sys_common/backtrace.rs:47:5
   8:   0x2cd3d4 - std::sys_common::backtrace::print::h2c6fa3bad4a1c4b0
                       at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/sys_common/backtrace.rs:34:9
   9:   0x2ccfc4 - std::panicking::default_hook::{{closure}}::h023cf5ed586259e3
                       at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:270:22
  10:   0x2cdf48 - std::panicking::default_hook::hd765af4164f1f2ae
                       at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:290:9
  11:   0x2cdf48 - std::panicking::rust_panic_with_hook::h1eafd525098eb4e0
                       at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:707:13
  12:   0x2cd980 - std::panicking::begin_panic_handler::{{closure}}::h6ab2b32eed05cbc8
                       at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:599:13
  13:   0x2cd920 - std::sys_common::backtrace::__rust_end_short_backtrace::h645a6c9d3619905e
                       at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/sys_common/backtrace.rs:170:18
  14:   0x2cd90c - rust_begin_unwind
                       at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:595:5
  15:    0x15544 - core::panicking::panic_fmt::h6e05c9dc45570a5b
                       at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/panicking.rs:67:14
  16:    0x1597c - core::result::unwrap_failed::he3e78dd3450c23a0
                       at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/result.rs:1652:5
  17:    0x51790 - fastwebsockets::ReadHalf::read_frame_inner::{{closure}}::he2f3b0d10bb4cd5c
  18:    0xdf400 - <tracing::instrument::Instrumented<T> as core::future::future::Future>::poll::h13297c047c573be9
  19:    0xbb418 - tokio::runtime::task::raw::poll::h2ef1c6bc0d73c262
  20:   0x2df384 - tokio::runtime::scheduler::multi_thread::worker::Context::run_task::h19e8c1cf0e134ba6
  21:   0x2e3204 - tokio::runtime::task::raw::poll::h3d6fdf5c1313dc21
  22:   0x2d326c - std::sys_common::backtrace::__rust_begin_short_backtrace::h257de911a19ea029
  23:   0x2d2f60 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h35131e7b0fe63359
  24:   0x2cebe0 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h0b33e0f468347f31
                       at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/alloc/src/boxed.rs:2007:9
  25:   0x2cebe0 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h17f831ed0c72a0ac
                       at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/alloc/src/boxed.rs:2007:9
  26:   0x2cebe0 - std::sys::unix::thread::Thread::new::thread_start::h677cc66a60376138
                       at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/sys/unix/thread.rs:108:17
Aborted
mikeliang commented 6 months ago

Redo the same test on macOS, it works perfectly, no crash appears.

erebe commented 6 months ago

Thanks, will try to take a look and to reproduce the issue

erebe commented 6 months ago

It should be fixed in https://github.com/erebe/wstunnel/releases/tag/v7.8.1 Can you let me know if it is ok for you ?

P.s: I messed up the packaging for arm in previous release, so if you are running on a 32bit raspberri pi you may want to use this version wstunnel_7.8.1_linux_armv7.tar.gz instead of wstunnel_7.8.1_linux_arm64.tar.gz

mikeliang commented 6 months ago

v7.8.1 works on my 64bit raspberry right now, big thanks for the quick response!

erebe commented 6 months ago

Yes ironically you were using the ARM32bit version because of my bad packaging. and the websocket librairy the project is using only has issue for 32bit architecture.

Thanks for letting me know it is ok :)