RFC: Server should execute requests on a thread pool when client does not specify an execution thread

オープン
#281 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
静か
技術スタック
cpp

調査の方向性

external-interfaces のトランスクリプトと、issue に記載されている現在の ThreadMap.makeThread および Context.thread の動作から始めます。サーバー側の thread pool の設計と、それが欠落した thread handle、mp.Context を持たないメソッド、callback、レスポンスの順序に及ぼす影響を明らかにします。ファイルやテストは指定されていないため、合意済みの RFC または実装計画があれば完了とします。

索引モデルが issue の本文から書いたものです。

説明

Referencing: https://btctranscripts.com/bitcoin-core-dev-tech/2026-05/external-interfaces

Problem: IPC interface can be awkward to call due to threading

  • Clients have to choose which thread asynchronous calls execute on, and create threads for calls to execute on
  • Could be improved by server executing requests on a thread pool when client does not specify an execution thread

Currently, clients that call IPC methods must first call ThreadMap.makeThread to create a server-side worker thread and pass the resulting Thread handle in Context.thread on every call so it executes on a dedicated thread. Libmultiprocess abstracts this away for C++ clients, but clients that don't use libmultiprocess (which only supports C++) must handle this setup manually, making the IPC interface more awkward to call.

Proposed improvement: When a client passes a null/missing Context.thread, or when a method has no mp.Context parameter at all, the server should fall back to executing the request on a server-managed thread pool instead of blocking the event loop thread or failing with "invalid thread handle". This would simplify non-libmultiprocess clients that doesn't need a dedicated thread model.

Caveats:

  • Callbacks require the client to still provide Context.callbackThread
  • Response ordering is not guaranteed when requests from the same client land on different pool threads. The dedicated thread model avoids this by always queuing requests from the same client on one thread
主要言語
C++
スター
62
フォーク
58
平均マージ
9日 9時間
マージ済み PR(30日)
3

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

bitcoin-core/libmultiprocess のほかの issue

bitcoin-core/libmultiprocess の issue をすべて見る

似ている issue

C++ の issue をもっと見る

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

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