Make the `YARA` scanner asynchronous to avoid blocking the event loop
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start with the YARA scanner's Scan() method, the inline eligibility and setup logic it contains, and the rwxs and mmaps maps, which will need a mutex. Also read Close(), where the drain must happen before the compiler is destroyed, and the config struct that will gain AsyncQueueSize and MaxWorkers. This is concurrency design work touching ETW event handling, so get maintainer agreement on the approach before writing code. Done means Scan() returns (false, nil) without blocking, drops are counted in yara.dropped.scans, and Close() waits for in-flight scans.
索引モデルが issue の本文から書いたものです。
説明
Motivation
The YARA scanner currently runs Scan() synchronously on the caller's goroutine, which means every scan, including the underlying libyara call executes inline on the ETW event processing path. This couples scan latency directly to event throughput: a slow or backed-up scan stalls the event loop rather than just delaying the scan result, which is a problem under high event volume or when scanning larger payloads (e.g. ADS reads).
Expectation
Scanning should no longer block event processing.
Scan()returns immediately after enqueuing the work; scan results reach consumers only through the existing alert-sender pipeline- Under load, once the pending-scan queue is full, new scan requests are dropped (not blocked), and the drop is observable via a metric
- The number of concurrent scan workers is bounded and configurable
- A
Wait()/Flush()mechanism allows draining in-flight scans deterministically (used by tests, and by shutdown)
Proposal
- Introduce a bounded queue (buffered, size controlled by a new AsyncQueueSize config option, default 1024).
Scan()does a non-blocking send. A full channel drops the event and increments ayara.dropped.scansmetric - Add a semaphore (
sem chan struct{}, capacity MaxWorkers, default 32, also configurable), gating how many scan goroutines run concurrently; a single dispatch() goroutine acquires a slot before launching each worker - Track every launched goroutine with a drainWg sync.WaitGroup so Close() can drain all in-flight work before destroying the YARA compiler, avoiding calls into libyara after
Destroy() - Extract the eligibility/setup logic currently inline in
Scan()into a function that runs synchronously on the caller's goroutine (fast path); only the actual yara.Scanner invocation moves into the worker pool. This includes making the ADSsys.ReadFileread synchronous (capped at 1MB with a 1s timeout) so scan bytes are captured before the event may be recycled - Protect the
rwxs/mmapsmaps with a mutex, since worker goroutines now write to them concurrently - Update the
Scan()interface contract: it currently returns (bool, error) with the bool indicating a match, which is incompatible with async execution. It should always return (false, nil), with match results delivered exclusively via the alert-sender pipeline - Add new config fields for
AsyncQueueSizeandMaxWorkers
Here is the proposed architecture diagram:
- 主要言語
- Go
- スター
- 2.6k
- フォーク
- 222
- 平均マージ
- 16時間 23分
- マージ済み PR(30日)
- 11
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
rabbitstack/fibratus のほかの issue
-
Service crashes on Windows Server 2016: "panic: sub-authority index out of range" in RidToStringオープンtype: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
rabbitstack/fibratus#761 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
CI: the test job has been red since September, and TestFsProcessor looks like a real mmap regressionオープンci
難易度 4/5 3〜5日 初心者へのやさしさ 22/100
rabbitstack/fibratus#754 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
ci rules type: enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
rabbitstack/fibratus#715 ·
メンテナーはふだん 1 日以内に返信
-
scope: hardering type: enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
rabbitstack/fibratus#713 ·
メンテナーはふだん 1 日以内に返信
-
needs: config scope: events/telemetry type: feature
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
rabbitstack/fibratus#710 ·
メンテナーはふだん 1 日以内に返信
rabbitstack/fibratus の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
unbound-force/replicator#193 ·
メンテナーはふだん 2 日以内に返信
-
A Gemini stream that fails partway completes the call with the partial text対応中かも @bnaylor が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
go-steer/core-agent#1600 ·
メンテナーはふだん 1 日以内に返信
-
bug raised-by:reviewer
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
medici-finance/assay#7655 ·
メンテナーはふだん 1 日以内に返信
-
enhancement good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
Edwin-metcalf/MetCode#67 ·
メンテナーはふだん 1 日以内に返信
-
bug good first issue
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信