Coder Social home page Coder Social logo

wasmedge / wasmedge_hyper_demo Goto Github PK

View Code? Open in Web Editor NEW
78.0 5.0 15.0 22.51 MB

Lightweight HTTP servers based on hyper / warp frameworks in the WasmEdge Runtime.

Rust 88.04% Dockerfile 11.96%
webassembly rust wasm http-server http http-client httpclient httpd

wasmedge_hyper_demo's Issues

instantiation failed: unknown import when linking module: "rustls_client" , function name: "new_codec"

I was trying to follow this demo for a personal usecase and was running into an error. I then copied the HTTPs example line for line and I'm getting the following stack when running the WASM file:

[2023-09-06 15:23:47.397] [error] instantiation failed: unknown import, Code: 0x62
[2023-09-06 15:23:47.397] [error]     When linking module: "rustls_client" , function name: "new_codec"
[2023-09-06 15:23:47.397] [error]     At AST node: import description
[2023-09-06 15:23:47.397] [error]     At AST node: import section
[2023-09-06 15:23:47.397] [error]     At AST node: module

Not sure what the issue is here. I'm running this on a Github Codespace with the following system information:

uname -a
Linux codespaces-61c5b6 5.15.0-1041-azure #48-Ubuntu SMP Tue Jun 20 20:34:08 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Problems running on win

The example of server-warp running on WIN,

 cargo --version
cargo 1.70.0-nightly (15d090969 2023-03-21)
wasmedge.exe .\target\wasm32-wasi\release\wasmedge_warp_server.wasm
thread 'main' panicked at 'error binding to 0.0.0.0:38080: error creating server listener: Function not implemented (os error 52)', C:\Users\xxx\.cargo\registry\src\mirrors.sjtug.sjtu.edu.cn-7a04d2510079875b\warp_wasi-0.3.3\src\server.rs:213:27
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[2023-03-25 22:03:24.514] [error] execution failed: unreachable, Code: 0x89
[2023-03-25 22:03:24.515] [error]     In instruction: unreachable (0x00) , Bytecode offset: 0x001113c4
[2023-03-25 22:03:24.515] [error]     When executing function name: "_start"

if set rustup stable ,build error

 rustup default stable
info: using existing install for 'stable-x86_64-pc-windows-msvc'
info: default toolchain set to 'stable-x86_64-pc-windows-msvc'

  stable-x86_64-pc-windows-msvc unchanged - rustc 1.68.0 (2c8cc3432 2023-03-06)

 rustup target add wasm32-wasi
info: component 'rust-std' for target 'wasm32-wasi' is up to date
 cargo build --target wasm32-wasi --release
   Compiling block-buffer v0.10.4
   Compiling crypto-common v0.1.6
   Compiling tokio-macros v1.8.2
   Compiling thiserror-impl v1.0.40
   Compiling errno v0.2.8
   Compiling hashbrown v0.12.3
   Compiling futures-channel v0.3.27
   Compiling mime v0.3.17
   Compiling url v2.3.1
   Compiling mime_guess v2.0.4
   Compiling serde v1.0.158
   Compiling unicase v2.6.0
   Compiling try-lock v0.2.4
   Compiling safemem v0.3.3
   Compiling ryu v1.0.13
   Compiling fastrand v1.9.0
error[E0554]: `#![feature]` may not be used on the stable release channel
  --> C:\Users\tab\.cargo\registry\src\mirrors.sjtug.sjtu.edu.cn-7a04d2510079875b\errno-0.2.8\src\lib.rs:20:33
   |
20 | #![cfg_attr(target_os = "wasi", feature(thread_local))]
   |                                 ^^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0554`.
error: could not compile `errno` due to previous error
warning: build failed, waiting for other jobs to finish...

ported to WAMR, hangs with multi-threaded runtime

Hey guys, I made a proof of concept port to WAMR. https://github.com/g0djan/wasmedge_hyper_demo/tree/wamr

Which seems to work well when demo compiled to wasm32-wasip1 and single threaded tokio runtime is used.

However one of the things I wanted to try out was wasm32-wasip1-threads target supported by WAMR, but I discovered that the same client example hangs for me if I compile to this target and use multi threaded tokio runtime.

I checked that if I just compile tokio to wasm32-wasip1-threads then it works well for me on WAMR. So I wanted to ask if implementation of any part of this demo was built single threaded only?

Build project in OSX

Hi,

I am trying to run the example this example:
https://github.com/jabrena/101-rust/blob/main/hello_world_wasm_backend/README.md

But I was not able to compile in OSX, I am receiving the following error:

docker compose build
[+] Building 1.3s (14/14) FINISHED                                                                                          
 => [internal] load build definition from Dockerfile                                                                   0.0s
 => => transferring dockerfile: 32B                                                                                    0.0s
 => [internal] load .dockerignore                                                                                      0.0s
 => => transferring context: 2B                                                                                        0.0s
 => [internal] load metadata for docker.io/library/rust:1.64                                                           1.2s
 => [buildbase 1/5] FROM docker.io/library/rust:1.64@sha256:922d814994d77f8e3ab8a7db45a277e9cebe41a557046eeef91a2e34b  0.0s
 => [internal] load build context                                                                                      0.0s
 => => transferring context: 86B                                                                                       0.0s
 => CACHED [buildbase 2/5] RUN rustup target add wasm32-wasi                                                           0.0s
 => CACHED [buildbase 3/5] WORKDIR /src                                                                                0.0s
 => CACHED [buildbase 4/5] COPY src ./src                                                                              0.0s
 => CACHED [buildbase 5/5] COPY Cargo.toml .                                                                           0.0s
 => CACHED [buildserver 1/3] COPY src ./src                                                                            0.0s
 => CACHED [buildserver 2/3] RUN pwd                                                                                   0.0s
 => CACHED [buildserver 3/3] RUN --mount=type=cache,target=/usr/local/cargo/git/db     --mount=type=cache,target=/usr  0.0s
 => CACHED [server 1/1] COPY --from=buildserver /src/target/wasm32-wasi/release/wasmedge_hyper_server.wasm wasmedge_h  0.0s
 => ERROR exporting to image                                                                                           0.0s
 => => exporting layers                                                                                                0.0s
 => => writing image sha256:9811b6619248d3846ca8c70d463c359854511b6539541b40dbfcb799b80e64f2                           0.0s
------
 > exporting to image:
------
failed to solve: operating system is not supported

docker compose up          
[+] Running 0/0
 ⠋ Container hello_world_wasm_backend-server-1  Creating                                                                                                                   0.0s
Error response from daemon: Unknown runtime specified io.containerd.wasmedge.v1

How to build the example in OSX?

Many thanks in advance

Juan Antonio

100% CPU utilization even after request is served[ wasmedge_hyper_server]

Hi,

I am trying to run the docker image of wasmedge_hyper_server in knative. And I observed that even after I got a successful response, the CPU utilization of the pod is 100% until the pod is brought down after some idle time. I tried to replicate the issue with rust only code (without wasm) which appears to be working fine.
I was not able to pinpoint the issue. Can anyone please give some input on the same.

image

Best Regards
Abhishek Sharma

Problems running on OSX (12.6)

Trying to run an example on my machine but I'm running into some weird issues, wondering if there's an easy explanation here

$ cargo --version                                                                                                                                                                                           
cargo 1.65.0 (4bc8f24d3 2022-10-20)
$ cargo build --target wasm32-wasi && wasmedge target/wasm32-wasi/debug/lsat-proxy.wasm                                                                                                                     
    Finished dev [unoptimized + debuginfo] target(s) in 0.07s
2022-11-22T15:32:18.202591Z  INFO lsat_proxy: Listening on http://0.0.0.0:8080
// when trying to curl from the second console
Error: Os { code: 52, kind: Unsupported, message: "Function not implemented" }

Looking at the code it errors exactly here when attempting to accept the incoming connection

 let (stream, _) = listener.accept().await?;

Not sure where to dig from here.

Edit: side note: running on M1 mac

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.