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

Fix concurrent invocations of preview2_tcp_bind test #7339

Merged
merged 1 commit into from
Oct 25, 2023

Conversation

alexcrichton
Copy link
Member

When binding a specific port allow AddressInUse errors to be returned in case the test is being concurrently run.

When binding a specific port allow `AddressInUse` errors to be returned
in case the test is being concurrently run.
@alexcrichton alexcrichton requested a review from a team as a code owner October 23, 2023 20:17
@alexcrichton alexcrichton requested review from fitzgen and removed request for a team October 23, 2023 20:17
@alexcrichton
Copy link
Member Author

Inspired by this failure

---- async_::preview2_tcp_bind stdout ----
preopen: TempDir { path: "C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\wasi_components_preview2_tcp_bind.component_Ir9gJE" }
[guest] stderr:
thread 'main' panicked at crates\test-programs\src\bin\preview2_tcp_bind.rs:26:40:
called `Result::unwrap()` on an `Err` value: ErrorCode { code: 1, name: "access-denied", message: "Access denied.\n                \n                POSIX equivalent: EACCES, EPERM" }
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: 0xdca1 - <unknown>!__rust_start_panic
    1: 0xdaf1 - <unknown>!rust_panic
    2: 0xdace - <unknown>!std::panicking::rust_panic_with_hook::hc93abff18edee779
    3: 0xce7a - <unknown>!std::panicking::begin_panic_handler::{{closure}}::h922bcdd9c6fdedfb
    4: 0xcda7 - <unknown>!std::sys_common::backtrace::__rust_end_short_backtrace::h2597d6ecb1d3419e
    5: 0xd3e9 - <unknown>!rust_begin_unwind
    6: 0x12371 - <unknown>!core::panicking::panic_fmt::h35d9e7e9c02f9eb5
    7: 0x13f1e - <unknown>!core::result::unwrap_failed::hdced1445f29366eb
    8: 0x1d10 - <unknown>!core::result::Result<T,E>::unwrap::h8771871f18bd21c1
    9: 0x2977 - <unknown>!preview2_tcp_bind::test_tcp_bind_specific_port::h06839cc116536f73
   10: 0x4b41 - <unknown>!preview2_tcp_bind::main::h1c857dbb109c43d1
   11: 0x17c5 - <unknown>!core::ops::function::FnOnce::call_once::hc44e1040ccca19f2
   12: 0x179c - <unknown>!std::sys_common::backtrace::__rust_begin_short_backtrace::h31f4e51a9e14bc5d
   13: 0x187d - <unknown>!std::rt::lang_start::{{closure}}::h91ee669c4893c2a3
   14: 0xb2d5 - <unknown>!std::rt::lang_start_internal::h394de9c4666f4612
   15: 0x1828 - <unknown>!std::rt::lang_start::h47a12d0663af1965
   16: 0x5109 - <unknown>!__main_void
   17: 0x1777 - <unknown>!_start
   18: 0x2dd4ed - 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_k8WqX4" }
[guest] stderr:
thread 'main' panicked at crates\test-programs\src\bin\preview2_tcp_bind.rs:26:40:
called `Result::unwrap()` on an `Err` value: ErrorCode { code: 1, name: "access-denied", message: "Access denied.\n                \n                POSIX equivalent: EACCES, EPERM" }
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: 0xdca1 - <unknown>!__rust_start_panic
    1: 0xdaf1 - <unknown>!rust_panic
    2: 0xdace - <unknown>!std::panicking::rust_panic_with_hook::hc93abff18edee779
    3: 0xce7a - <unknown>!std::panicking::begin_panic_handler::{{closure}}::h922bcdd9c6fdedfb
    4: 0xcda7 - <unknown>!std::sys_common::backtrace::__rust_end_short_backtrace::h2597d6ecb1d3419e
    5: 0xd3e9 - <unknown>!rust_begin_unwind
    6: 0x12371 - <unknown>!core::panicking::panic_fmt::h35d9e7e9c02f9eb5
    7: 0x13f1e - <unknown>!core::result::unwrap_failed::hdced1445f29366eb
    8: 0x1d10 - <unknown>!core::result::Result<T,E>::unwrap::h8771871f18bd21c1
    9: 0x2977 - <unknown>!preview2_tcp_bind::test_tcp_bind_specific_port::h06839cc116536f73
   10: 0x4b41 - <unknown>!preview2_tcp_bind::main::h1c857dbb109c43d1
   11: 0x17c5 - <unknown>!core::ops::function::FnOnce::call_once::hc44e1040ccca19f2
   12: 0x179c - <unknown>!std::sys_common::backtrace::__rust_begin_short_backtrace::h31f4e51a9e14bc5d
   13: 0x187d - <unknown>!std::rt::lang_start::{{closure}}::h91ee669c4893c2a3
   14: 0xb2d5 - <unknown>!std::rt::lang_start_internal::h394de9c4666f4612
   15: 0x1828 - <unknown>!std::rt::lang_start::h47a12d0663af1965
   16: 0x5109 - <unknown>!__main_void
   17: 0x1777 - <unknown>!_start
   18: 0x2dd4ed - 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 268.63s

Although this doesn't actually fix that failure. I'd probably have to open up Windows to debug that specific failure a bit more.

@fitzgen fitzgen requested review from pchickey and removed request for fitzgen October 25, 2023 16:15
@fitzgen
Copy link
Member

fitzgen commented Oct 25, 2023

Redirecting review to @pchickey since I'm not familiar with this corner of the project.

Copy link
Member

@sunfishcode sunfishcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@alexcrichton alexcrichton added this pull request to the merge queue Oct 25, 2023
Merged via the queue into bytecodealliance:main with commit 1c81b5c Oct 25, 2023
18 checks passed
@alexcrichton alexcrichton deleted the fix-flaky-tcp-test branch October 25, 2023 18:02
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 this pull request may close these issues.

3 participants