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

Ouverte
#7,063 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
48/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
rust
Domaine
backend

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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.)

Langage dominant
Rust
Étoiles
11.8k
Forks
628
Merge moyen
2 j 22 h
PR mergées (30 j)
50

Préparer son environnement

Ouvrir dans Codespaces

Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de quickwit-oss/quickwit

Toutes les issues de quickwit-oss/quickwit

Issues similaires

Plus d'issues Rust

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.