fix(spider-storage): Reserve UNAVAILABLE gRPC status code for network connection errors. - #358
Conversation
LinZhihao-723
left a comment
There was a problem hiding this comment.
@sitaowang1998 Please check this PR since it may affect the error handling in the coming service implementations.
|
Warning Review limit reached
More reviews will be available in 59 minutes and 48 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughgRPC error-code mappings were updated in the storage service and the execution-manager client. The storage service now returns ChangesgRPC status mapping updates
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
UNAVAILABLE so it cleanly signals a lost connection.UNAVAILABLE gRPC status code for network connection errors.
…add-missing-services
Description
UNAVAILABLEwas being returned by user code in two storage handlers, which made it ambiguous: a genuine transport failure (lost or unestablished connection) and an application-level error both surfaced asUNAVAILABLE, so the execution-manager client could not tell them apart. Per the gRPC status-code guidance, only a small set of codes are appropriate for user code to return, andUNAVAILABLEis best left to the transport. This PR remaps the two offending cases onto application-appropriate codes and updates the execution-manager client to treatUNAVAILABLEas a transport error. It closes the follow-up flagged at the end of #354.Server changes (
spider-storage/src/grpc.rs)job_orchestration_service_error_handler: a fatal cache-internal error now returnsINTERNALinstead ofUNAVAILABLE(it still fires the cancellation token and restarts the service).task_instance_management_service_error_handler: a request from a stale session now returnsNOT_FOUNDinstead ofUNAVAILABLE. The other mappings are unchanged.Client changes (
spider-execution-manager/src/client/grpc/storage.rs)status_to_errornow mapsCode::UnavailabletoStorageResponseError::Transport, so a lost or unestablished connection is reported as a transport failure rather than as an application error.Code::NotFound→StorageResponseError::StaleSession. This is required for correctness — without it, the server's newNOT_FOUNDstale-session response would fall through to the genericServercase and stale-session handling would silently break.status_maps_unavailable_to_stale_sessionwithstatus_maps_not_found_to_stale_session, and addedstatus_maps_unavailable_to_transport.Checklist
breaking change.
Validation performed
Summary by CodeRabbit