MergePipeline deadlocks on graceful shutdown if a merge actor fails before or during shutdown

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

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

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

評価

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

調査の方向性

Read quickwit/quickwit-indexing/src/actors/merge_pipeline.rs, focusing on perform_health_check and the handlers for FinishPendingMergesAndShutdownPipeline and Spawn. Trace the shutdown and retry paths described in the issue, then inspect nearby tests for merge pipeline supervision. Done means each listed interleaving exits the actor cleanly while the shutdown request still receives a successful reply.

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

説明

bug
Description

MergePipeline can hang indefinitely after receiving FinishPendingMergesAndShutdownPipeline when a child actor fails (e.g., transient object-storage or metastore error) either right before or during graceful shutdown.

Root Cause

In quickwit/quickwit-indexing/src/actors/merge_pipeline.rs:

  1. perform_health_check (lines 404–428):
    • When self.handles_opt is None, it returns Ok(()) even if self.shutdown_initiated is true.
    • When Health::FailureOrUnhealthy occurs, it calls self.terminate().await (setting self.handles_opt = None) and schedules Spawn { retry_count: 0 }, even if self.shutdown_initiated is true.
  2. Handler<FinishPendingMergesAndShutdownPipeline> (lines 480–515):
    • Sets self.shutdown_initiated = true. If self.handles_opt is currently None (e.g., the pipeline just terminated after a failure and is waiting for Spawn backoff, or initial spawn failed and is retrying), it takes the else branch and returns Ok(()).
  3. Handler<Spawn> (lines 519–529):
    • Sees if self.shutdown_initiated { return Ok(()); } instead of exiting the actor.

Once self.shutdown_initiated == true and self.handles_opt.is_none(), SuperviseLoop continues ticking every second forever and MergePipeline never terminates (blocking graceful shutdown / decommission until an external timeout kills it).

Triggering Interleavings
  1. Failure during shutdown: FinishPendingMergesAndShutdownPipeline sets shutdown_initiated = true -> a merge actor (e.g., MergeSplitDownloader, Uploader, Publisher) fails on a transient storage/metastore error -> perform_health_check terminates actors (handles_opt = None) and schedules Spawn -> Spawn returns Ok(()) -> SuperviseLoop loops forever.
  2. Shutdown during failure backoff: A merge actor fails -> perform_health_check calls self.terminate().await (handles_opt = None) and schedules Spawn after HEARTBEAT -> FinishPendingMergesAndShutdownPipeline arrives before Spawn, sees handles_opt = None, returns Ok(()) -> Spawn returns Ok(()) -> SuperviseLoop loops forever.
  3. Shutdown during initial spawn retry: spawn_pipeline() fails on a transient metastore error (handles_opt = None) and schedules retry Spawn -> FinishPendingMergesAndShutdownPipeline arrives -> SuperviseLoop loops forever.
Suggested Fix

In quickwit/quickwit-indexing/src/actors/merge_pipeline.rs:

  • In perform_health_check:
    • If self.handles_opt is None and self.shutdown_initiated is true, return Err(ActorExitStatus::Success).
    • On Health::FailureOrUnhealthy, after self.terminate().await, if self.shutdown_initiated is true, return Err(ActorExitStatus::Success) instead of scheduling Spawn.
  • In Handler<Spawn>:
    • If self.shutdown_initiated is true, return Err(ActorExitStatus::Success).

(Keeping Handler<FinishPendingMergesAndShutdownPipeline> returning Ok(()) preserves clean ask(FinishPendingMergesAndShutdownPipeline) replies for callers, while the next SuperviseLoop / Spawn tick exits cleanly with ActorExitStatus::Success.)

主要言語
Rust
スター
11.8k
フォーク
628
平均マージ
2日 22時間
マージ済み PR(30日)
50

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

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

quickwit-oss/quickwit のほかの issue

quickwit-oss/quickwit の issue をすべて見る

似ている issue

Rust の issue をもっと見る

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

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