WASI incoming HTTP handler can get stuck for JS componets when interleaving (Rust components work)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- javascript, rust, typescript, wasm
調査の方向性
wasm-share-state2 ブランチの問題を、crates/wasm-runtime-axum/examples/standalone と 2 つの curl リクエストを使って再現し、Rust と TypeScript の fixture を比較してください。まず crates/wasm-runtime-host/src/lib.rs の wasi_incoming_http_handler 付近と、host.rs のクエリ処理付近から調べ、次にリンクされている guest handler を確認してください。2 回目の JS リクエストが停止しなくなり、その挙動が Rust コンポーネントと一貫したら完了です。
索引モデルが issue の本文から書いたものです。
説明
For a long time, I wanted to change the execution model of my wasmtime runtimes from being ephemeral and short-lived to being long-lived, i.e. reusing a store to interleave multiple HTTP requests (instead of constructing and destroying requests per state).
I actually had it rolled out at some point to then roll back because it worked for rust components but not for:
- JS components
- and only if the JS component calls a host interface.
To be clear, besides having a shallow understanding of where it locks up, I don't understand what the issue is, e.g. it could be an issue with my host implementations (though it works for rust), it could be an issue with jco or seamonkey's js event loop, wasmtime itself, .... 🤷♀️. Out of ignorance, I filed the issue here but happy to move it elsewhere 🙏
Test Case
git clone https://github.com/trailbaseio/trailbase.git
cd trailbase
git checkout wasm-share-state2
cd crates/wasm-runtime-axum
# Running with the "working" Rust component
cargo run --example standalone -- --path=../../client/testfixture/wasm/wasm_guest_testfixture.wasm
# Will produce an error but the second run of curl won't block up the system.
curl "localhost:3000/addDeletePost"
curl "localhost:3000/addDeletePost"
# Running with the "broken" JS component
cargo run --example standalone -- --path=../../client/testfixture/wasm/wasm_ts_guest_testfixture.wasm
curl "localhost:3000/addDeletePost"
curl "localhost:3000/addDeletePost"
Note, the above is running pre-built, checked-in WASM components. Their respective HTTP handler implementations live here:
- https://github.com/trailbaseio/trailbase/blob/wasm-share-state2/client/testfixture/guests/rust/src/lib.rs#L71
- https://github.com/trailbaseio/trailbase/blob/wasm-share-state2/client/testfixture/guests/typescript/src/index.ts#L49
When running curl the second time for the JS component, it's this call to wasi_incoming_http_handler: https://github.com/trailbaseio/trailbase/blob/57e912f042e44f313139f99f59bd54ec968fba3b/crates/wasm-runtime-host/src/lib.rs#L354 that gets stuck.
A potential culprit is how I hacked the async host function, I.e. the component-side query() sends and outgoing http-request that is intercepted and handled here: https://github.com/trailbaseio/trailbase/blob/57e912f042e44f313139f99f59bd54ec968fba3b/crates/wasm-runtime-host/src/host.rs#L126-L130
(The latter is one of the reasons why I've sat this out so long, I was hoping that WASIp3 may fix my issue, but it seems I keep running into obstacles 🥲 )
Expected Results
Ideally I would expect the JS component to behave like the Rust component. However, them behaving more consistently would already be an improvement.
Actual Results
Execution gets stuck.
Versions and Environment
Wasmtime version or commit: v46
Operating system: debian
Architecture: amd64
- 主要言語
- C
- スター
- 293
- フォーク
- 61
- 平均マージ
- 1日 6時間
- マージ済み PR(30日)
- 12
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
bytecodealliance/StarlingMonkey のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
bytecodealliance/StarlingMonkey#343 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 52/100
bytecodealliance/StarlingMonkey#339 ·
メンテナーはふだん 1 日以内に返信
-
The forgiving decoder implementation is ignoring padding and whitespaces in crypto-algorithm.cppオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 52/100
bytecodealliance/StarlingMonkey#338 ·
メンテナーはふだん 1 日以内に返信
-
FinalizationRegistry callbacks never run: no host cleanup callback is set対応中かも @veeshi が 3 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
bytecodealliance/StarlingMonkey#327 · コメント 5 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
bytecodealliance/StarlingMonkey#322 · コメント 2 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
bytecodealliance/StarlingMonkey の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
polhenarejos/pico-fido#302 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
espressif/esp-vision#16 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
libsdl-org/SDL#16577 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
halt_error adds a trailing newline for non-string input, contrary to the manual対応中かも @Huang-404-Q が今日担当しました。 オープン
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 2 日以内に返信