0xMiden / 0xMiden/note-transport-service
No graceful shutdown (SIGTERM drops in-flight work, streams, telemetry)
- Langage dominant
- Rust
- Étoiles
- 3
- Forks
- 10
- Merge moyen
- 2 h 23 min
- PR mergées (30 j)
- 4
Description
Severity: critical/high.
### Summary
There is no signal handling anywhere. `node.entrypoint()` (`bin/node/src/main.rs:80-81`) calls into `Server::serve()` (`crates/node/src/node/grpc/mod.rs:126`, not `serve_with_shutdown`), and no `tokio::signal` usage exists. The OTEL providers are never shut down (`crates/node/src/logging.rs` has no `shutdown()` calls).
### Impact
On SIGTERM (k8s eviction, `docker stop`) the process is terminated with default disposition:
- in-flight `SendNote` writes are cut (WAL keeps this crash-safe, but not clean);
- open `StreamNotes` streams are dropped without a GOAWAY drain;
- health is never flipped to NOT_SERVING, so the LB keeps routing during shutdown;
- OTEL spans/metrics buffered since the last export are lost.
### Recommendation
Install a SIGTERM + `ctrl_c` handler that: marks health NOT_SERVING, calls `serve_with_shutdown` with a drain grace period, signals the streamer to stop, cancels the maintenance task, and shuts down the OTEL tracer/meter providers.
---
Part of #114.
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez par examiner le point d'entrée dans bin/node/src/main.rs et la fonction Server::serve dans crates/node/src/node/grpc/mod.rs. Recherchez la gestion des signaux existante et l'arrêt des fournisseurs OTEL dans crates/node/src/logging.rs. L'objectif est de mettre en œuvre un arrêt gracieux : marquer l'état de santé comme NOT_SERVING, utiliser serve_with_shutdown, vider les flux, annuler les tâches et arrêter les fournisseurs OTEL. Testez avec SIGTERM et vérifiez que les écritures en cours, les flux et la télémétrie sont traités proprement.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Domaine
- backend, devops, observability-sre
- Type d'issue
- Fonctionnalité
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- Calme
- Clarté
- Clairement spécifiée
- Accessibilité débutants
- 45/100