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

OS Error 28 when starting server #66

Open
jcuffe opened this issue Sep 11, 2022 · 9 comments
Open

OS Error 28 when starting server #66

jcuffe opened this issue Sep 11, 2022 · 9 comments

Comments

@jcuffe
Copy link

jcuffe commented Sep 11, 2022

Hey all, I'm unable to start any of the example http servers from the WasmEdge book and I'm completely stumped! I also encounter this exact error when trying to start up the server for any of the React examples from the book. In the case of the react app, the error originates from calling new WasiTcpServer(PORT) with any value for port.

❯ wasmedge ./target/wasm32-wasi/release/http_server.wasm
new connection at 1234
Error: Os { code: 28, kind: InvalidInput, message: "Invalid argument" }

~/http_server                                                                                                                                                                           
❯ uname -sr
Linux 5.15.0-46-generic

~/http_server                                                                                                                                                                           
❯ uname -a
Linux bropletop 5.15.0-46-generic #49~20.04.1-Ubuntu SMP Thu Aug 4 19:15:44 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

~/http_server                                     
❯ wasmedge --version
wasmedge version 0.9.1

~/http_server                                     
❯ cargo --version
cargo 1.62.0 (a748cf5a3 2022-06-08)

I've slogged through the setup of crun, crio, kubernetes and the lot, and using pre-built images works fine, but I can't seem to get the bytecode running on my local machine. Any advice would be appreciated!

@juntao
Copy link
Member

juntao commented Sep 11, 2022

Please upgrade to wasmedge 0.11. There are some breaking changes to the APIs in both 0.10 and 0.11 releases. We are going to a fast iteration phase of the runtime development to better support all these extensions. Thanks!

@jcuffe
Copy link
Author

jcuffe commented Sep 12, 2022

This worked, thank you for the quick response and apologies for not trying that first!

@jcuffe jcuffe closed this as completed Sep 12, 2022
@jcuffe
Copy link
Author

jcuffe commented Sep 18, 2022

@juntao I've encountered this error again while attempting to run the http_server example under KinD. My guess is that the kind-crun-wasm:v1.23.4 image is not using wasmedge 0.11, but I have been unable to get any images to run using a KinD image I've built myself.

Reproduction using the latest KinD image from liquid-reply

❯ kind create cluster --image ghcr.io/liquid-reply/kind-crun-wasm:v1.23.4
...
You can now use your cluster with:
...

❯ kubectl run -it --rm --restart=Never http-server --image=jcuffe/http-server:latest --annotations="module.wasm.image/variant=compat"
new connection at 1234
Error: Os { code: 28, kind: InvalidInput, message: "Invalid argument" }
pod "http-server" deleted

Dockerfile for my attempt at creating a custom image

FROM ubuntu:22.04 AS builder

WORKDIR /data
RUN DEBIAN_FRONTEND=noninteractive apt update
RUN DEBIAN_FRONTEND=noninteractive apt install -y curl make git gcc build-essential pkgconf libtool libsystemd-dev libprotobuf-c-dev libcap-dev libseccomp-dev libyajl-dev go-md2man libtool autoconf python3 automake
RUN curl https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash -s -- -p /usr/local
RUN git clone --single-branch --branch main https://github.com/containers/crun

WORKDIR /data/crun
RUN ./autogen.sh
RUN ./configure --with-wasmedge --enable-embedded-yajl
RUN make

FROM kindest/node:v1.23.0

COPY config.toml /etc/containerd/config.toml
COPY --from=builder /data/crun/crun /usr/local/sbin/runc
COPY --from=builder /usr/local/lib/libwasmedge.so /usr/local/lib/libwasmedge.so

RUN echo "Installing Packages ..." \
   && bash -c 'cat <<< $(jq "del(.hooks.createContainer)" /etc/containerd/cri-base.json) > /etc/containerd/cri-base.json' \
   && ldconfig

Result of run against cluster with custom image

❯ kind create cluster --image node-wasmedge
...
You can now use your cluster with:
...

❯ kubectl run -it --rm --restart=Never http-server --image=jcuffe/http-server:latest --annotations="module.wasm.image/variant=compat"
{"msg":"exec container process `/http_server.wasm`: Exec format error","level":"error","time":"2022-09-18T22:57:14.000246110Z"}
pod "http-server" deleted
pod default/http-server terminated (Error)

I seem to be looping endlessly around Exec format error issues 😖 sorry to be such a bother, but I'm very interested in getting the examples to actually work in a cluster.

My goal is to have the React SSR example and the Rust HTTP server example communicate with each other. I hope that once I can at least run curl commands against each of them while they run in a KinD cluster, the rest should be straightforward Kubernetes administration and app development.

@jcuffe jcuffe reopened this Sep 18, 2022
@juntao
Copy link
Member

juntao commented Sep 19, 2022

Hi @jcuffe I want to make sure that we are using the correct crun and WasmEdge versions. The combos that are known to work are

  • WasmEdge 0.11 + crun master branch
  • WasmEdge 0.10 + crun 1.5
  • WasmEdge 0.9.1 + crun 1.4.5

Now you are using the hyper crate, which is supported in WasmEdge 0.11, so you will have to use the latest crun master branch. Is that the case? Thanks.

@jcuffe
Copy link
Author

jcuffe commented Sep 19, 2022

@juntao I believe so. From my Dockerfile:

RUN git clone --single-branch --branch main https://github.com/containers/crun

@jcuffe
Copy link
Author

jcuffe commented Sep 19, 2022

Also I'm unsure what you mean by the "hyper" crate, could you explain? I have heard of this crate but do not see it in my dependency tree:

❯ cargo tree
http_server v0.1.0 (/home/jcuffe/projects/http_server)
├── bytecodec v0.4.15
│   ├── byteorder v1.4.3
│   └── trackable v0.2.24
│       ├── trackable v1.2.0
│       │   └── trackable_derive v1.0.0 (proc-macro)
│       │       ├── quote v1.0.21
│       │       │   └── proc-macro2 v1.0.43
│       │       │       └── unicode-ident v1.0.3
│       │       └── syn v1.0.99
│       │           ├── proc-macro2 v1.0.43 (*)
│       │           ├── quote v1.0.21 (*)
│       │           └── unicode-ident v1.0.3
│       └── trackable_derive v1.0.0 (proc-macro) (*)
├── httpcodec v0.2.3
│   ├── bytecodec v0.4.15 (*)
│   └── trackable v0.2.24 (*)
└── wasmedge_wasi_socket v0.4.1
    └── libc v0.2.132

The Exec format error I'm seeing may actually be outside the scope of this project, apologies if so. I'm posting here because I only see it when attempting to build my own KinD image, which I chose to do because I saw the error in the topic title when running a wasmedge_wasi_socket app under the image suggested by the WasmEdge book.

I will crosspost the exec format error issue to the main Wasmedge repository.

@juntao
Copy link
Member

juntao commented Sep 19, 2022

Sorry, I thought you are using the more convenient tokio / mio / hyper stack for your server app. It is here. You should try it. :)

https://github.com/WasmEdge/wasmedge_hyper_demo/tree/main/server

@jcuffe
Copy link
Author

jcuffe commented Sep 19, 2022

I will try this soon, thank you for the suggestion! It is hard to keep up with you guys 😅

@juntao
Copy link
Member

juntao commented Sep 19, 2022

Yeah, this is a fast evolving space. Thank you for your patience!

If you are interested in other Kubernetes integration options besides kinD, we have ongoing CIs to use other combos of containerd, CRI-o, Kubernetes etc.

https://github.com/second-state/wasmedge-containers-examples

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

No branches or pull requests

2 participants