Restart the discovery service instead of aborting the gateway #2193
All Vouch review confidence checks passed
Residual risk 0.28 = Change Risk (0.50) × (1 − Review Confidence (0.45)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 385 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.356
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #2193"
general
weight: 0.35
baum
Fixes: #1342
What changed
Today, when the discovery service sub-process terminates, the SIGCHLD handler raises
SystemExitand the whole gateway goes down. With this change:GatewayServermethod. If the terminated child is the discovery service, it schedules a restart instead of exiting. Any other child (SPDK, monitor client) still aborts the gateway exactly as before.keep_alive()loop (main thread) afterrestart_intervalseconds, not from the signal handler, so the gateway keeps serving without a discovery service in the meantime.restart_attempts_limitconsecutive failures the gateway aborts, with the sameGateway subprocess terminated pid=... exit_code=...message as today. A discovery service that ran for at least 60 seconds resets the consecutive failures count, so an occasional crash on a long-running gateway doesn't accumulate toward the limit._start_discovery_service()is split so the fork part (_fork_discovery_service()) can be reused for restarts. The SPDK discovery subsystem deletion still only happens on the initial start.reap_child_process(); the old module-levelsigchld_handlerhad no other users and was removed.New options in the
[discovery]section (documented inceph-nvmeof.conf):| Option | Default | Meaning |
|---|---|---|
|
restart_attempts_limit|3| Consecutive restarts before giving up.0keeps the old behavior (abort on the first failure). ||
restart_interval|5.0| Seconds to wait before restarting. |Tests
test_server.py::test_discovery_exitandtest_discovery_bind.py::test_discovery_bind_abortassert the old abort-on-first-failure behavior, so they now setrestart_attempts_limit = 0(on a copy of the config) to keep covering that path.test_server.py::test_discovery_restart: kills the discovery service, runskeep_alive()and checks a new discovery process was started; then kills it again and checks the gateway aborts once over the limit.flake8 passes. I don't have the containerized environment locally, so I exercised the new methods against a stub server with a fake clock (restarts up to the limit then abort, the 60s reset,
0= old behavior, non-discovery child still aborts) and am relying on CI for the real tests.Notes for reviewers
python3 -m control.discoverywithsubprocess, but that would lose in-memory config overrides that tests rely on, so I kept the existing fork model.