etcdutl: add context-aware timeout to hash command with exit 124 #21584
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 183 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 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.312
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #21584"
general
weight: 0.35
hwdef
Fixes #20276
Problem
etcdutl hashhangs indefinitely when the bbolt db is locked by another process. The root cause is two-fold:1.
backend.NewDefaultBackendcallszap.Logger.Panic(notreturn err) whenbolt.Openfails — so the existing--timeoutflock mechanism panics the process rather than returning cleanly.2. When
--timeout 0, bbolt blocks forever and the process never returns.Fix
getHashin a goroutine and selects on acontext.WithTimeoutdeadline, bounded by the existing--timeoutroot flagtimeout(1)convention)getHashto prevent the panic path; the context deadline is the sole timeout mechanismTests
Three new unit tests in
bucket_command_test.go:| Test | What it covers |
|---|---|
|
TestRunHashWithTimeout_Success| db available, returns without error ||
TestRunHashWithTimeout_Timeout| db held locked by a secondbolt.Open, verifiescontext.DeadlineExceeded— directly reproduces #20276 ||
TestRunHashWithTimeout_ZeroTimeout|timeout=0means no deadline, succeeds on unlocked db |