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

The preview2_tcp_bind test is flaky #7429

Closed
alexcrichton opened this issue Oct 31, 2023 · 2 comments · Fixed by #7438
Closed

The preview2_tcp_bind test is flaky #7429

alexcrichton opened this issue Oct 31, 2023 · 2 comments · Fixed by #7438

Comments

@alexcrichton
Copy link
Member

I can't figure out what's going on here so I'm going to open a tracking issue. This if for this failure which looks like this:

---- async_::preview2_tcp_bind stdout ----
preopen: TempDir { path: "C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\wasi_components_preview2_tcp_bind.component_hZxoQE" }
[guest] stderr:
thread 'main' panicked at crates\test-programs\src\bin\preview2_tcp_bind.rs:34:19:
error: access-denied (error 1)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

===
thread 'async_::preview2_tcp_bind' panicked at crates\wasi\tests\all\async_.rs:319:51:
called `Result::unwrap()` on an `Err` value: error while executing at wasm backtrace:
    0: 0xe2f1 - <unknown>!__rust_start_panic
    1: 0xe141 - <unknown>!rust_panic
    2: 0xe11e - <unknown>!std::panicking::rust_panic_with_hook::hc93abff18edee779
    3: 0xd4ca - <unknown>!std::panicking::begin_panic_handler::{{closure}}::h922bcdd9c6fdedfb
    4: 0xd3f7 - <unknown>!std::sys_common::backtrace::__rust_end_short_backtrace::h2597d6ecb1d3419e
    5: 0xda39 - <unknown>!rust_begin_unwind
    6: 0x129c1 - <unknown>!core::panicking::panic_fmt::h35d9e7e9c02f9eb5
    7: 0x2f82 - <unknown>!preview2_tcp_bind::test_tcp_bind_specific_port::he40761acd6a2af48
    8: 0x4e9e - <unknown>!preview2_tcp_bind::main::h47d079031e93f9b9
    9: 0x17d1 - <unknown>!core::ops::function::FnOnce::call_once::h1a7ef71025f93dd4
   10: 0x17a8 - <unknown>!std::sys_common::backtrace::__rust_begin_short_backtrace::h93f974fb575844d0
   11: 0x1889 - <unknown>!std::rt::lang_start::{{closure}}::h64df62ed2be5009e
   12: 0xb925 - <unknown>!std::rt::lang_start_internal::h394de9c4666f4612
   13: 0x1834 - <unknown>!std::rt::lang_start::h103283f62218f32f
   14: 0x5466 - <unknown>!__main_void
   15: 0x1783 - <unknown>!_start
   16: 0x2e103c - wit-component:adapter:wasi_snapshot_preview1!wasi:cli/run@0.2.0-rc-2023-11-05#run
note: using the `WASMTIME_BACKTRACE_DETAILS=1` environment variable may show more debugging information

Caused by:
    wasm trap: wasm `unreachable` instruction executed
stack backtrace:
   0: rust_begin_unwind
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src/panicking.rs:595:5
   1: core::panicking::panic_fmt
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\core\src/panicking.rs:67:14
   2: core::result::unwrap_failed
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\core\src/result.rs:1652:5
   3: core::result::Result<T,E>::unwrap
   4: all::async_::preview2_tcp_bind::{{closure}}::test_impl::{{closure}}
   5: all::async_::preview2_tcp_bind::{{closure}}
   6: <core::pin::Pin<P> as core::future::future::Future>::poll
   7: tokio::runtime::park::CachedParkThread::block_on::{{closure}}
   8: tokio::runtime::park::CachedParkThread::block_on
   9: tokio::runtime::context::blocking::BlockingRegionGuard::block_on
  10: tokio::runtime::scheduler::multi_thread::MultiThread::block_on::{{closure}}
  11: tokio::runtime::context::runtime::enter_runtime
  12: tokio::runtime::scheduler::multi_thread::MultiThread::block_on
  13: tokio::runtime::runtime::Runtime::block_on
  14: all::async_::preview2_tcp_bind
  15: all::async_::preview2_tcp_bind::{{closure}}
  16: core::ops::function::FnOnce::call_once
  17: core::ops::function::FnOnce::call_once
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\core\src\ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

---- sync::preview2_tcp_bind stdout ----
preopen: TempDir { path: "C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\wasi_components_preview2_tcp_bind.component_TmfeeA" }
[guest] stderr:
thread 'main' panicked at crates\test-programs\src\bin\preview2_tcp_bind.rs:34:19:
error: access-denied (error 1)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

===
thread 'sync::preview2_tcp_bind' panicked at crates\wasi\tests\all\sync.rs:262:45:
called `Result::unwrap()` on an `Err` value: error while executing at wasm backtrace:
    0: 0xe2f1 - <unknown>!__rust_start_panic
    1: 0xe141 - <unknown>!rust_panic
error: test failed, to rerun pass `-p wasmtime-wasi --test all`
    2: 0xe11e - <unknown>!std::panicking::rust_panic_with_hook::hc93abff18edee779
    3: 0xd4ca - <unknown>!std::panicking::begin_panic_handler::{{closure}}::h922bcdd9c6fdedfb
    4: 0xd3f7 - <unknown>!std::sys_common::backtrace::__rust_end_short_backtrace::h2597d6ecb1d3419e
    5: 0xda39 - <unknown>!rust_begin_unwind
    6: 0x129c1 - <unknown>!core::panicking::panic_fmt::h35d9e7e9c02f9eb5
    7: 0x2f82 - <unknown>!preview2_tcp_bind::test_tcp_bind_specific_port::he40761acd6a2af48
    8: 0x4e9e - <unknown>!preview2_tcp_bind::main::h47d079031e93f9b9
    9: 0x17d1 - <unknown>!core::ops::function::FnOnce::call_once::h1a7ef71025f93dd4
   10: 0x17a8 - <unknown>!std::sys_common::backtrace::__rust_begin_short_backtrace::h93f974fb575844d0
   11: 0x1889 - <unknown>!std::rt::lang_start::{{closure}}::h64df62ed2be5009e
   12: 0xb925 - <unknown>!std::rt::lang_start_internal::h394de9c4666f4612
   13: 0x1834 - <unknown>!std::rt::lang_start::h103283f62218f32f
   14: 0x5466 - <unknown>!__main_void
   15: 0x1783 - <unknown>!_start
   16: 0x2e103c - wit-component:adapter:wasi_snapshot_preview1!wasi:cli/run@0.2.0-rc-2023-11-05#run
note: using the `WASMTIME_BACKTRACE_DETAILS=1` environment variable may show more debugging information

Caused by:
    wasm trap: wasm `unreachable` instruction executed
stack backtrace:
   0: rust_begin_unwind
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src/panicking.rs:595:5
   1: core::panicking::panic_fmt
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\core\src/panicking.rs:67:14
   2: core::result::unwrap_failed
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\core\src/result.rs:1652:5
   3: core::result::Result<T,E>::unwrap
   4: all::sync::preview2_tcp_bind::test_impl
   5: all::sync::preview2_tcp_bind
   6: all::sync::preview2_tcp_bind::{{closure}}
   7: core::ops::function::FnOnce::call_once
   8: core::ops::function::FnOnce::call_once
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\core\src\ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.


failures:
    async_::preview2_tcp_bind
    sync::preview2_tcp_bind

test result: FAILED. 170 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in 300.39s

This is on the MinGW platform (so Windows) and the precise commit at the time was cd89543.

I also saw this before with a similar failure (but slightly different code)

I'm running this in a loop locally on Windows and it's not failing, so I'm not entirely sure.

cc @badeend

@badeend
Copy link
Contributor

badeend commented Oct 31, 2023

@alexcrichton I think this is exactly the same issue as #7339, except that Windows sometimes returns EACCESS instead of EADDRINUSE (depending on some arcane rules I still don't fully understand)

Hopefully, changing Err(ErrorCode::AddressInUse) => {} to Err(ErrorCode::AddressInUse | ErrorCode::AccessDenied) => {} in the test will "fix" this.

@alexcrichton
Copy link
Member Author

Oh wow now that is a set of tables! Makes sense though, and thanks for pointing that out! I'll look to add this tomorrow unless you beat me to it

alexcrichton added a commit to alexcrichton/wasmtime that referenced this issue Nov 1, 2023
This commit adds another case to handle in the TCP bind test which binds
a specific port to handle concurrent invocations of the test.

Closes bytecodealliance#7429
github-merge-queue bot pushed a commit that referenced this issue Nov 1, 2023
* Fix flakiness in tcp_bind test

This commit adds another case to handle in the TCP bind test which binds
a specific port to handle concurrent invocations of the test.

Closes #7429

* Add comments
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.

2 participants