gRPC 1 CANCELLED vs 10 ABORTED
Both gRPC 1 (CANCELLED) and 10 (ABORTED) belong to the gRPC Status Codes category. 1 indicates that the operation was cancelled, typically by the caller. Meanwhile, 10 means that the operation was aborted, typically due to a concurrency issue such as a sequencer check failure or transaction abort.
描述
The operation was cancelled, typically by the caller.
何时出现
The client explicitly cancelled the RPC, or a deadline or context cancellation propagated to the server before it could finish processing.
如何修复
If unexpected, check whether the client is setting too-short deadlines or if cancellation is being triggered inadvertently in your call chain.
描述
The operation was aborted, typically due to a concurrency issue such as a sequencer check failure or transaction abort.
何时出现
A transaction or optimistic concurrency check failed — for example, a read-modify-write cycle detected a conflict with another concurrent operation.
如何修复
Retry the entire read-modify-write sequence from the beginning. Implement proper optimistic concurrency control with version tokens or ETags.
主要区别
gRPC 1: The operation was cancelled, typically by the caller.
gRPC 10: The operation was aborted, typically due to a concurrency issue such as a sequencer check failure or transaction abort.
You encounter 1 when the client explicitly cancelled the RPC, or a deadline or context cancellation propagated to the server before it could finish processing.
You encounter 10 when a transaction or optimistic concurrency check failed — for example, a read-modify-write cycle detected a conflict with another concurrent operation.
何时使用哪个
For 1 (CANCELLED): If unexpected, check whether the client is setting too-short deadlines or if cancellation is being triggered inadvertently in your call chain. For 10 (ABORTED): Retry the entire read-modify-write sequence from the beginning. Implement proper optimistic concurrency control with version tokens or ETags.