Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Redline: a watchdog thread is started for every call into native code

クローズ
#201 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@andreaTP がすでに取り組んでいます。

2026年9月23日 から。

  • #210 @andreaTP による — オープン

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
java, wasm

調査の方向性

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

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

bytecodealliance/endive のほかの issue

bytecodealliance/endive の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。