Redline: a watchdog thread is started for every call into native code
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 55/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- java, wasm
- 領域
- backend, performance
調査の方向性
Start with JffiNativeMachine.call() and the Panama NativeMachine.call() implementations, focusing on how each creates and interrupts its watchdog thread. Review the quickjs4j investigation measurements mentioned in the issue. Done means native calls no longer start a thread per invocation while preserving the intended interrupt handling and avoiding the reported performance regression.
索引モデルが issue の本文から書いたものです。
説明
JffiNativeMachine.call() and the Panama NativeMachine.call() create, start and then interrupt a new watchdog Thread on every call into native code (it polls caller.isInterrupted() every 1 ms to raise the interrupt flag):
Thread watchdog = new Thread(() -> { ... Thread.sleep(1); ... });
watchdog.setDaemon(true);
watchdog.start();
try { result = invokeViaEntryTrampoline(...); } finally { watchdog.interrupt(); ... }
A host function that calls back into an export (e.g. cabi_realloc to return a value) pays it again for the nested call. Measured on quickjs4j (Endive 1.1.0, javy module): 16 threads started per JS evaluation, 58 per Camel message, versus 0 on bytecode. It makes an evaluation ~2.4x slower than the bytecode build-time compiler single-threaded, and ~6x slower with 8 threads, where thread creation serializes.
Removing the watchdog from the 1.1.0 jffi runner brings the native path back in line (numbers in the quickjs4j investigation).
Suggested fix: one shared daemon watchdog (or none at all, checking the caller's interrupt flag from the host-call / memory-grow safepoints), never a thread per call.
🤖 Generated with Claude Code
- 主要言語
- Java
- スター
- 310
- フォーク
- 23
- 平均マージ
- 1日 22時間
- マージ済み PR(30日)
- 34
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
bytecodealliance/endive のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
bytecodealliance/endive#225 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
bytecodealliance/endive#224 · コメント 8 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
bytecodealliance/endive#211 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
bytecodealliance/endive#203 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
bytecodealliance/endive#181 · コメント 3 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
bytecodealliance/endive の issue をすべて見る
似ている issue
-
BoxAttachmentMulti parsing leaks IOException / ArrayIndexOutOfBoundsException on malformed content instead of IllegalArgumentException対応中かも @Kshot3000 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
ergoplatform/ergo-appkit#272 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
utopia-rise/godot-jvm#1004 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
spring-projects/spring-grpc#442 ·