~EThread does not close its eventfd or pipe, leaking descriptors per TSThreadCreate/TSThreadDestroy

オープン 初心者向け
#14,199 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

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

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
82/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
cpp, linux

調査の方向性

src/iocore/eventsystem/UnixEThread.cc の100~141行付近にある eventfd/pipe の設定と、src/api/InkIOCoreAPI.cc の92行および215行付近にある専用スレッドのライフサイクルを読む。ディスクリプターがどのように初期化され、どの値が開かれたことを示すのかを確認し、破棄時に該当するディスクリプターが閉じられることを検証する。プラグインスレッドの作成と破棄を繰り返しても、それらのディスクリプターが開いたままにならなくなれば完了。

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

説明

Bug Core Event System Leak Threads TS API

EThread(ThreadType, int) opens an eventfd (or, without eventfd, a pipe) for waking the thread (https://github.com/apache/trafficserver/blob/eeeada36e1dff81822977bc36016d4264d64cdb8/src/iocore/eventsystem/UnixEThread.cc#L100-L122). ~EThread releases the thread mutex but never closes evfd or evpipe (https://github.com/apache/trafficserver/blob/eeeada36e1dff81822977bc36016d4264d64cdb8/src/iocore/eventsystem/UnixEThread.cc#L132-L141).

Most event threads live for the whole process, but INKThreadInternal, which backs the plugin thread API, is constructed with EThread(DEDICATED, -1) (https://github.com/apache/trafficserver/blob/eeeada36e1dff81822977bc36016d4264d64cdb8/src/api/InkIOCoreAPI.cc#L92), so every TSThreadCreate or TSThreadInit opens a descriptor (two for the pipe), and TSThreadDestroy deletes the object (https://github.com/apache/trafficserver/blob/eeeada36e1dff81822977bc36016d4264d64cdb8/src/api/InkIOCoreAPI.cc#L215) without closing them. A plugin that creates and destroys threads repeatedly (for example plugins/experimental/magick, https://github.com/apache/trafficserver/blob/eeeada36e1dff81822977bc36016d4264d64cdb8/plugins/experimental/magick/magick.cc#L111) leaks one descriptor per thread until it hits the fd limit.

Suggested fix: close evfd / evpipe[0..1] in ~EThread when they were opened. A dedicated thread may not need a wakeup descriptor at all.


generated with Claude Opus 5.5 by Josiah VanderZee

主要言語
C++
スター
2k
フォーク
903
平均マージ
4日 4時間
マージ済み PR(30日)
135

環境構築

はじめの一歩

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

apache/trafficserver のほかの issue

apache/trafficserver の issue をすべて見る

似ている issue

C++ の issue をもっと見る

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

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