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

feat: Show the URL of streaming WASM modules in stack traces #12268

Merged
merged 2 commits into from
Oct 10, 2021

Conversation

andreubotella
Copy link
Contributor

WebAssembly modules compiled through WebAssembly.compile() and similar non-streaming APIs don't have a URL associated to them, because they have been compiled from a buffer source. In stack traces, V8 will use a URL such as wasm://wasm/d1c677ea, with a hash of the module.

However, wasm modules compiled through streaming APIs, like WebAssembly.compileStreaming(), do have a known URL, which can be obtained from the Response object passed into the streaming APIs. And as per the developer-facing display conventions in the WebAssembly Web API spec, this URL should be used in stack traces. This change implements that.

Closes #12151.


This PR depends on denoland/rusty_v8#786, and won't run on CI until a release of rusty_v8 containing that commit, and the corresponding serde_v8 release, are published.

@andreubotella
Copy link
Contributor Author

cli/tests/testdata/unreachable.wasm is the same as the bytes in cli/tests/testdata/wasm_unreachable.js. Should we change the latter to read unreachable.wasm from the file system?

@bartlomieju
Copy link
Member

cli/tests/testdata/unreachable.wasm is the same as the bytes in cli/tests/testdata/wasm_unreachable.js. Should we change the latter to read unreachable.wasm from the file system?

SGTM

@andreubotella andreubotella marked this pull request as ready for review October 4, 2021 23:46
WebAssembly modules compiled through `WebAssembly.compile()` and similar
non-streaming APIs don't have a URL associated to them, because they
have been compiled from a buffer source. In stack traces, V8 will use
a URL such as `wasm://wasm/d1c677ea`, with a hash of the module.

However, wasm modules compiled through streaming APIs, like
`WebAssembly.compileStreaming()`, do have a known URL, which can be
obtained from the `Response` object passed into the streaming APIs. And
as per the developer-facing display conventions in the WebAssembly
Web API spec, this URL should be used in stack traces. This change
implements that.

Closes denoland#12151.
@andreubotella
Copy link
Contributor Author

CI is now passing, so this can now be reviewed.

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Andreu, this LGTM. @bnoordhuis does this pose any problems for Deploy integration?

@bnoordhuis
Copy link
Contributor

I don't think so. Nothing that can't be trivially fixed anyway.

@bartlomieju bartlomieju merged commit 5edd277 into denoland:main Oct 10, 2021
@andreubotella andreubotella deleted the wasm-module-url branch October 10, 2021 17:08
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

Successfully merging this pull request may close these issues.

Stack traces in streaming WASM modules should show the module URL
3 participants