wasmtime-dotnet icon indicating copy to clipboard operation
wasmtime-dotnet copied to clipboard

Trap Stackoverflow Test

Open martindevans opened this issue 3 years ago • 6 comments

My other PR (#151) was failing CI on MacOS only, I think this is due to a bug in wasmtime dotnet, although I'm not sure what and unfortunately I cannot debug it further since I don't own a Mac.

This PR includes the minimal set of changes to (hopefully) reproduce the problem.

Note that the nuint change is necessary to prevent an OverflowException (as mentioned in #150).

martindevans avatar Sep 15 '22 13:09 martindevans

As expected this PR has failed CI. As mentioned above I can't debug it any further, I hope this helps someone with access to a Mac debug the issue.

martindevans avatar Sep 15 '22 13:09 martindevans

I have been testing this, and found that Native.wasmtime_func_call crashes the test runner if the executed wasm overflows the stack. I have seen this happen on master, so this is a bug unrelated to this PR.

TomGillen avatar Sep 15 '22 15:09 TomGillen

I've just put together a test of this in Rust which is fine when run on macos (using GH actions). So it seems to not be a bug in the underlying library.

martindevans avatar Sep 16 '22 13:09 martindevans

I've been doing even more testing with GH actions.

As you can see from this execution log for this program works when you run it with:

dotnet run --project ConsoleApp/ConsoleApp/ConsoleApp.csproj

However, the same code copied into a test and run with:

dotnet test wasmtime-dotnet/tests/Wasmtime.Tests.csproj

Crashes!

I don't really have any ideas how to debug this further...

martindevans avatar Sep 16 '22 18:09 martindevans

I'll dive into this soon and figure out why it's failing in the test host; perhaps it is installing a mach exception handler that is interfering with Wasmtime's.

peterhuene avatar Sep 19 '22 22:09 peterhuene

I'll still be looking into this issue, but I'm not holding up the 1.0.0 release for it as I believe it's a test-host only problem.

peterhuene avatar Sep 26 '22 20:09 peterhuene