fix(cli): add recover() guard to queryRDSInstancesInRegions worker goroutine#1111
Conversation
…routine A panic in one region's worker (nil deref, SDK type assertion failure, slice OOB) crashed the whole CLI process. Add a deferred recover() that logs the panic with region context and lets the remaining goroutines complete, mirroring the pattern applied to Lambda goroutines in PR #859 (issue #672). Closes #997
|
@coderabbitai review Generated by Claude Code |
|
Warning Review limit reached
More reviews will be available in 49 minutes and 37 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Get PR details
gh pr view 1111 --repo LeanerCloud/CUDly
echo "---DIFF---"
gh pr diff 1111 --repo LeanerCloud/CUDlyLength of output: 2592 🏁 Script executed: #!/bin/bash
# Read the fanout.go file for pattern comparison
fd -e go fanout.go | xargs cat
echo "---FULL GOROUTINE CONTEXT---"
# Read the full file
fd -e go multi_service_engine_versions.go | xargs cat
echo "---ISSUE 997---"
gh issue view 997 --repo LeanerCloud/CUDly 2>/dev/null || echo "Issue not accessible"Length of output: 22209
Defer order (the critical correctness question): The recover guard executes before the cleanup defers, catches the panic, then Consistency with
One minor observation (not blocking): The implementation satisfies the issue [approve] 🧠 Learnings used |
|
@coderabbitai full review |
✅ Action performedFull review finished. |
Summary
cmd/multi_service_engine_versions.go:112spawns one goroutine per AWS region that callsqueryRDSInstancesInRegion(map writes + AWS SDK calls, both can panic). A panic in one region's worker crashed the whole CLI process, silently aborting all remaining regions.recover()that logs the panic with region context (log.Printf("ERROR: panic in region worker (region=%s): %v\n%s", regionName, r, buf[:n])), then allows the goroutine to exit cleanly. The other workers continue andwg.Wait()collects their results.Closes #997
Test plan
go build ./cmd/...succeeds.go test ./cmd/...passes (all existing tests green).internal/execution/fanout.gorecover() guard which has a unit test asserting panic isolation (TestFanOut_PanicInFn).Labels (mirrored from issue #997)
priority/p3severity/lowurgency/eventuallyimpact/internaleffort/xstype/bugtriagedGenerated by Claude Code