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
Bad File Descriptor when trying to connect TCP listener #8526
Comments
What version of wasmtime are you using? I only know more recent versions where the "tcplisten" parameter is paired with "-S" and has to be given immediately after the "run" argument, like so: wasmtime \
run \
-S tcplisten=127.0.0.1:8080 \
./wasi-server.wasm |
@FrankReh thanks for the response. I am using the following version:
I've now switched to the following command:
And I get the following error: |
Yes, that's as far as I get now too and that is puzzling. Now I'm looking into the commit that introduced that code to understand things better. Coincidentally, I had asked why this was happening a day or two ago myself with no response yet. |
Okay. What you and I were missing is another wasmtime run -S preview2=n -S tcplisten=127.0.0.1:8080 ./wasi-server.wasm The transition from the Rust Wasm world only being modules to now having both Wasm modules and Wasm components has created some confusion - at least for me. I incorrectly assumed if With that new version of the command, your example works and prints out the line you were expecting. Note that the actual pub fn compute_preopen_sockets(&self) -> Result<Vec<TcpListener>> {
let mut listeners = vec![];
for address in &self.common.wasi.tcplisten {
let stdlistener = std::net::TcpListener::bind(address)
.with_context(|| format!("failed to bind to address '{}'", address))?;
let _ = stdlistener.set_nonblocking(true)?;
listeners.push(stdlistener)
}
Ok(listeners)
} |
Sorry this has been confusing, I think that our error messages and the choice of
|
@pchickey Wow! That's a lot of interesting background. Thanks for that. There was probably a busy loop making the |
I don't have much more to add over what @pchickey already mentioned, but otherwise can confirm that this is working as expected. Some things I can say are: From the OP @maxwellflitton you're using:
That's actually passing the
where the error To me the action items here are:
|
I have the following code:
It compiles to the target
wasm32-wasi
fine, but when I try and run it with the following command:and I get the following error:
The text was updated successfully, but these errors were encountered: