0xMiden / 0xMiden/note-transport-service

No graceful shutdown (SIGTERM drops in-flight work, streams, telemetry)

未關閉
#119 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
enhancement production-readiness
主要語言
Rust
星號
3
分支
10
平均合併
2 小時 23 分鐘
30 天內合併 PR
4

描述

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.

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。