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

Wasm build hangs when using WasmEdge #85429

Closed
mrhockeymonkey opened this issue Apr 26, 2023 · 4 comments
Closed

Wasm build hangs when using WasmEdge #85429

mrhockeymonkey opened this issue Apr 26, 2023 · 4 comments
Assignees
Labels
arch-wasm WebAssembly architecture area-VM-meta-mono os-wasi Related to WASI variant of arch-wasm
Milestone

Comments

@mrhockeymonkey
Copy link

Description

I have been kicking the tyres on dotnet wasm builds using the Wasi.Sdk nuget package. I have a very simple console app that prints out the RuntimeInformation.OSArchitecture as a test. When using wasmtime.exe this works fine but when using wasmedge.exe it seems to just hang.

As I understand work in that area has moved away from dotnet/dotnet-wasi-sdk. If this issue has potentially been fixed am I able to test it in a preview or nightly build?

I like to check in on this tracking issue but I'm not sure if any of this work is made available for us to use/test?

If there isn't a known fix then I just wanted to flag this since docker now supports wasmedge but not wasmtime as far as I can tell. For example it would be nice to run this as see the expected output

docker container run --rm --runtime=io.containerd.wasmedge.v1 --platform=wasi/wasm my-image:latest

Reproduction Steps

using System.Runtime.InteropServices;
using DateTime = System.DateTime;

namespace WasiConsole;
class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine($"Hello from {RuntimeInformation.OSArchitecture} at {DateTime.Now}");
    }
}
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net7.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Wasi.Sdk" Version="0.1.1" />
  </ItemGroup>

</Project>

Expected behavior

& "C:\Program Files\Wasmtime\bin\wasmtime.exe" .\bin\Debug\net7.0\WasiConsole.wasm
Hello from Wasm at 04/26/2023 22:25:21

& "C:\Users\Scott\Downloads\WasmEdge-0.12.0-windows\bin\wasmedge.exe" .\bin\Debug\net7.0\WasiConsole.wasm
Hello from Wasm at 04/26/2023 22:25:21

Actual behavior

& "C:\Program Files\Wasmtime\bin\wasmtime.exe" .\bin\Debug\net7.0\WasiConsole.wasm
Hello from Wasm at 04/26/2023 22:25:21

& "C:\Users\Scott\Downloads\WasmEdge-0.12.0-windows\bin\wasmedge.exe" .\bin\Debug\net7.0\WasiConsole.wasm
(hangs)

Regression?

No response

Known Workarounds

No response

Configuration

.NET SDK 7.0.201
Windows 10

Other information

This issue may be related but looks like it is more to do with networking rather than hanging

@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Apr 26, 2023
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Apr 26, 2023
@marek-safar marek-safar added arch-wasm WebAssembly architecture os-wasi Related to WASI variant of arch-wasm labels Apr 27, 2023
@ghost
Copy link

ghost commented Apr 27, 2023

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

I have been kicking the tyres on dotnet wasm builds using the Wasi.Sdk nuget package. I have a very simple console app that prints out the RuntimeInformation.OSArchitecture as a test. When using wasmtime.exe this works fine but when using wasmedge.exe it seems to just hang.

As I understand work in that area has moved away from dotnet/dotnet-wasi-sdk. If this issue has potentially been fixed am I able to test it in a preview or nightly build?

I like to check in on this tracking issue but I'm not sure if any of this work is made available for us to use/test?

If there isn't a known fix then I just wanted to flag this since docker now supports wasmedge but not wasmtime as far as I can tell. For example it would be nice to run this as see the expected output

docker container run --rm --runtime=io.containerd.wasmedge.v1 --platform=wasi/wasm my-image:latest

Reproduction Steps

using System.Runtime.InteropServices;
using DateTime = System.DateTime;

namespace WasiConsole;
class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine($"Hello from {RuntimeInformation.OSArchitecture} at {DateTime.Now}");
    }
}
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net7.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Wasi.Sdk" Version="0.1.1" />
  </ItemGroup>

</Project>

Expected behavior

& "C:\Program Files\Wasmtime\bin\wasmtime.exe" .\bin\Debug\net7.0\WasiConsole.wasm
Hello from Wasm at 04/26/2023 22:25:21

& "C:\Users\Scott\Downloads\WasmEdge-0.12.0-windows\bin\wasmedge.exe" .\bin\Debug\net7.0\WasiConsole.wasm
Hello from Wasm at 04/26/2023 22:25:21

Actual behavior

& "C:\Program Files\Wasmtime\bin\wasmtime.exe" .\bin\Debug\net7.0\WasiConsole.wasm
Hello from Wasm at 04/26/2023 22:25:21

& "C:\Users\Scott\Downloads\WasmEdge-0.12.0-windows\bin\wasmedge.exe" .\bin\Debug\net7.0\WasiConsole.wasm
(hangs)

Regression?

No response

Known Workarounds

No response

Configuration

.NET SDK 7.0.201
Windows 10

Other information

This issue may be related but looks like it is more to do with networking rather than hanging

Author: mrhockeymonkey
Assignees: -
Labels:

arch-wasm, untriaged, os-wasi, needs-area-label

Milestone: -

@marek-safar marek-safar added area-VM-meta-mono and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Apr 27, 2023
@marek-safar
Copy link
Contributor

/cc @pavelsavara

@pavelsavara
Copy link
Member

probably duplicate dotnet/dotnet-wasi-sdk#5

@pavelsavara pavelsavara added this to the 8.0.0 milestone Apr 27, 2023
@pavelsavara pavelsavara removed the untriaged New issue has not been triaged by the area owner label Apr 27, 2023
@lewing lewing modified the milestones: 8.0.0, Future Apr 28, 2023
@mrhockeymonkey
Copy link
Author

I had a go at running the same console app (renamed) on ubuntu and turns out both wasmtime and wasmedge work fine in that scenario.

dotnet build -c Release

wasmtime ./bin/Release/net7.0/cs-hello.wasm
# Hello from Wasm at 04/30/2023 10:20:27

wasmedge ./bin/Release/net7.0/cs-hello.wasm
# Hello from Wasm at 04/30/2023 10:20:54

Since that is the case I do now wonder if its an issue with the wasmedge runtime itself, not .NET. Since this is all new evolving stuff I'm happy if you want to close this issue.

If interested, I moved my experiment over to ubuntu and recorded some results here

@ghost ghost locked as resolved and limited conversation to collaborators Jun 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-VM-meta-mono os-wasi Related to WASI variant of arch-wasm
Projects
None yet
Development

No branches or pull requests

4 participants