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

wasi-sockets: Add SO_REUSEADDR back in #7690

Merged
merged 6 commits into from
Dec 17, 2023

Conversation

badeend
Copy link
Contributor

@badeend badeend commented Dec 14, 2023

In #7662 the call to bind_existing_tcp_listener was replaced with rustix::net::bind. Unfortunately, besides calling bind, bind_existing_tcp_listener also set SO_REUSEADDR. This PR restores that behavior. I've added an integration test and a note to the WITs too.

Unrelated: I also removed the workarounds in the Bind tests:

        // Concurrent invocations of this test can yield `AddressInUse` and that
        // same error can show up on Windows as `AccessDenied`.
        Err(ErrorCode::AddressInUse | ErrorCode::AccessDenied) => return,

by using a random generated port instead of a single constant.

This inadvertently removed in 8ca8056 when switching from `bind_existing_tcp_listener` to `rustix::net::bind`
@badeend badeend requested a review from a team as a code owner December 14, 2023 17:27
@badeend badeend requested review from fitzgen and removed request for a team December 14, 2023 17:27
@github-actions github-actions bot added the wasi Issues pertaining to WASI label Dec 14, 2023
@alexcrichton alexcrichton added this pull request to the merge queue Dec 14, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 14, 2023
@badeend
Copy link
Contributor Author

badeend commented Dec 17, 2023

This should be good to go again.

In ran into EADDRINUSE issues on my local machine when binding to a specific (but random) port. So I've modified the tests to give it a few attempts.

@alexcrichton alexcrichton added this pull request to the merge queue Dec 17, 2023
Merged via the queue into bytecodealliance:main with commit e6a9fa1 Dec 17, 2023
18 checks passed
dhil pushed a commit to dhil/wasmtime that referenced this pull request Dec 29, 2023
* Restore SO_REUSEADDR.

This inadvertently removed in 8ca8056 when switching from `bind_existing_tcp_listener` to `rustix::net::bind`

* Remove AddressInUse workarounds by generating a random port.

* fmt

* Ignore unused_variables warning

* Prevent spurious test failures by trying again a few times on EADDRINUSE

* Fix grammar in .wit documentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wasi Issues pertaining to WASI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants