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

.NET: Wasmtime.TrapException: trap during instantiation #753

Closed
hrumhurum opened this issue Dec 28, 2019 · 8 comments
Closed

.NET: Wasmtime.TrapException: trap during instantiation #753

hrumhurum opened this issue Dec 28, 2019 · 8 comments
Assignees

Comments

@hrumhurum
Copy link

Trying to follow a step by step example at https://github.com/bytecodealliance/wasmtime-demos/tree/master/dotnet

It produces the following result:

Unhandled exception. Wasmtime.TrapException: trap during instantiation
at Wasmtime.Instance..ctor(Module module, IHost host)
at Wasmtime.Module.Instantiate(IHost host)
at WasmtimeDemo.Program.Main() in wasmtime-demos-master\dotnet\Program.cs:line 20

Please find enclosed markdown.wasm file for your further reference (not sure where the problem is located).

markdown.zip

@peterhuene peterhuene self-assigned this Jan 2, 2020
@peterhuene
Copy link
Member

Hi @hrumhurum. Thanks for reporting this.

It looks like there's been a regression with module instantiation and I'm looking into it.

@peterhuene
Copy link
Member

It appears that the latest wasm target is putting in multiple tables:

(table (;1;) 32 anyref)

The instantiation succeeds if this table is omitted, but as the wasm-bindgen memory management functions are no longer being exported, the demo fails to allocate memory for the string.

@peterhuene
Copy link
Member

peterhuene commented Jan 2, 2020

@hrumhurum what Rust version are you using and on what platform? I'm having problems reproducing it on macOS, but I'm able to on Windows.

Attached should be a working markdown.wasm if you would like to continue with the demo while I continue my investigation.

markdown.wasm.zip

@hrumhurum
Copy link
Author

rustc 1.40.0 (73528e339 2019-12-16)
Windows

@peterhuene peterhuene changed the title Wasmtime.TrapException: trap during instantiation .NET: Wasmtime.TrapException: trap during instantiation Jan 3, 2020
@peterhuene
Copy link
Member

The underlying toolset changes appear to be breaking the other demos as well: bytecodealliance/wasmtime-demos#13

@alexcrichton
Copy link
Member

This is likely due to the release of 0.2.56 of wasm-bindgen which includes a rewrite of how interface types are implemented. In addition to tables here wasmtime also doesn't support the new binary format for interface types, which will likely cause errors later as well. I hope to update wasmtime to the new binary representation but it's a relatively significant undertaking.

@peterhuene
Copy link
Member

That is indeed the problem.

Should we snap to 0.2.55 for markdown in wasmtime-demos as a workaround for now since users are going to want something working to follow along to?

@peterhuene
Copy link
Member

@hrumhurum thanks again for reporting this issue to us!

As this was caused by downstream dependencies of the demo repository, we've now merged a change that will get the markdown demo project working again.

The master branch of the wasmtime-demos repository now contains a fix. Please pull the fix and rebuild the markdown project. This should generate a wasm file that works with the .NET demo.

Please let me know if that does not resolve the issue for you. Thanks!

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

3 participants