fix(grpc): return errors instead of panicking for unservable FollowTip/WatchTx intersect - #1226
fix(grpc): return errors instead of panicking for unservable FollowTip/WatchTx intersect#1226AmbientTea wants to merge 1 commit into
Conversation
ChainStream::start ran ChainCrawler::start inside an async_stream::stream! block and unwrapped both its Result and its Option. A client resuming FollowTip or WatchTx from a point this node no longer holds (e.g. after a snapshot restore) hit the None case on every subscription, panicking a tokio worker while the client's stream just hung open with no status. Move the fallible crawler start ahead of the stream! block and have ChainStream::start return Result<Option<Stream>, DomainError>: None means the intersect wasn't found, Err means the crawler itself failed to start. Callers in the v1alpha/v1beta sync and watch services map None to Status::not_found (naming the requested points) and Err to Status::internal. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
Included review availability: Your plan includes up to 2 reviews per rolling hour; 1 remains after this review. 📝 WalkthroughWalkthrough
ChangesChain stream startup handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This localized change replaces panic paths with returned errors for unservable stream intersections; no actionable merge-blocking risk remains beyond normal checks and review. Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant GRPCHandler
participant ChainStream
participant ChainCrawler
GRPCHandler->>ChainStream: start with intersection
ChainStream->>ChainCrawler: start crawler
ChainCrawler-->>ChainStream: startup result
alt startup error
ChainStream-->>GRPCHandler: internal status
else no matching intersection
ChainStream-->>GRPCHandler: not-found status
else stream available
ChainStream-->>GRPCHandler: continue stream setup
end
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Hello, I'm submitting a fix for a panic that bit me when subscribing to the block events stream:
Issue
ChainStream::startcallsunwraptwice: when creating the crawler and when searching for the intersect point. This caused panics in Dolos when the client tried to connect with cursor that resulted in an empty intersection, which left the client hanging on the open connection.Solution
Change
ChainStream::startto returnResult(crawler creation errors) of anOption(no intersection point found), and turn those two cases into distinguishable errors in the callers.Summary by CodeRabbit