BFD hot loop when required_rx is 0

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

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

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

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
rust
領域
networking

調査の方向性

async BFD session driver とその receive-timeout calculation から始め、次に timer negotiation に関する関連 issue #798 を読んでください。required_rx = 0 と独立した heartbeat を持つ current-thread Tokio テストを追加し、ゼロ以外の remote Desired Min TX interval に対するカバレッジも追加してください。unbounded expiration loop が発生せず、heartbeat が実行され続ければ完了です。

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

説明

bfd Bug mgd needs testing rust

The following is an issue identified by AI when I asked it to do an adversarial code review of #795. This was pre-existing in the sync/pthread impl, which is why it was not addressed as part of the async swap-out.

Problem

BFD configuration permits required_rx = 0.

The state machine currently computes its receive timeout approximately
as:

local.required_min_rx * local.detection_multiplier

When required_rx is zero, every receive deadline equals the current
instant. The session driver repeatedly:

  1. observes an immediately expired timeout;
  2. re-arms another immediate timeout;
  3. increments the timeout counter;
  4. loops again.

The synchronous implementation had the same basic timer defect, but it
consumed a dedicated BFD thread. The async implementation runs this loop
on mgd's shared Tokio runtime, increasing the impact on unrelated BFD
sessions and API work.

Impact

One configuration can cause persistent CPU consumption and scheduler
pressure. Multiple such sessions may affect unrelated work running on
the Tokio runtime.

Protocol consideration

RFC 5880 gives Required Min RX Interval zero a meaning: the system does
not want to receive periodic BFD Control packets. It does not mean that
the receive deadline should continually expire.

Correct detection-time calculation also depends on the remote Desired
Min TX interval, so fixing timer negotiation may naturally eliminate
the zero deadline.

Proposed direction

This should be coordinated with #798.

Possible approaches:

  • represent a disabled periodic receive expectation explicitly; or
  • calculate the detection deadline from the negotiated interval rather
    than local Required Min RX alone; or
  • reject zero at the management boundary if Maghemite intentionally
    chooses not to support its RFC meaning.

The driver should also avoid repeatedly expiring a receive timer while
the session is already Down.

Testing

Add a current-thread Tokio test containing:

  • a session configured with required_rx = 0; and
  • an independent heartbeat task.

Verify that the heartbeat continues to run and the BFD driver does not
produce an unbounded stream of expiration events.

Also test zero in combination with a nonzero remote Desired Min TX
interval after timer negotiation is implemented.

Related issues

  • #798: BFD timer negotiation is non-existent
  • oxidecomputer/omicron#10657: BFD configuration validation
主要言語
Rust
スター
100
フォーク
8
平均マージ
2日 1時間
マージ済み PR(30日)
18

環境構築

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

はじめの一歩

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

oxidecomputer/maghemite のほかの issue

oxidecomputer/maghemite の issue をすべて見る

似ている issue

Rust の issue をもっと見る

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

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