Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Wasmtime: block on async and reqwest #19

Closed
radu-matei opened this issue Feb 26, 2021 · 2 comments · Fixed by #23 or #28
Closed

Wasmtime: block on async and reqwest #19

radu-matei opened this issue Feb 26, 2021 · 2 comments · Fixed by #23 or #28
Labels
help wanted Extra attention is needed

Comments

@radu-matei
Copy link
Member

radu-matei commented Feb 26, 2021

Linker-defined functions cannot be asynchronous yet (see bytecodealliance/wasmtime#2434).

This means the actual host call that performs the HTTP request must at some point block - and depending on how the runtime was started, it is possible for it to just hang right now, and the current implementation is put together without any thought into how other runtimes might need to use this.

let res = match block_on(
client
.request(method, &url)
.headers(headers)
.body(req_body)
.send(),
) {

cc @thomastaylor312

@radu-matei radu-matei added the help wanted Extra attention is needed label Feb 26, 2021
@thomastaylor312
Copy link
Contributor

@radu-matei I’d use the blocking reqwest client for now. However at least for Tokio you can tell if you are on a runtime with Handle::try_current() and then spawning on the runtime handle if it exists

@radu-matei
Copy link
Member Author

radu-matei commented Mar 6, 2021

After some more testing with WAGI, it turns out that blocking on the current executor could end up deadlocking.
Spawning a new one could fix it.

Reopening.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Extra attention is needed
Projects
None yet
2 participants