kitex
kitex copied to clipboard
feat(gRPC): optimize gRPC error handling
What type of PR is this?
feat
Check the PR title.
- [ ] This PR title match the format: <type>(optional scope): <description>
- [ ] The description of this PR title is user-oriented and clear enough for others to understand.
- [ ] Attach the PR updating the user documentation if the current PR requires user awareness at the usage level. User docs repo
(Optional) Translate the PR title into Chinese.
(Optional) More detailed description for this PR(en: English/zh: Chinese).
en:
- Optimising the gRPC client side call to streaming.Send to return ```the stream is done`` now allows you to get the real reason why the stream is being shut down
- Optimise the error returned when a connection is closed on the gRPC client/server side by uniformly converting
ConnectionError
tocode = 14, msg = ConnectionError.Desc
status - Optimise the error returned by gRPC server-side calls to streaming.Recv/Send, so that when the stream is closed we can get the real reason instead of "context is canceled".
- For the streaming call string scenario A -> B -> C, an error between A and B causes the ctx to be cancelled, making the call between B and C go wrong. Add ‘[triggered by handler side]’, '[triggered by remote service]' to the error string to better alert the user.
- Add log in the scenario where an RstStream Frame is sent under an exception on the gRPC server side.
zh(optional):
- 优化 gRPC client 侧调用 streaming.Send 返回
the stream is done
,现在可以拿到流被关闭的真正原因 - 优化 gRPC client/server 侧连接被关闭时返回的错误,统一将
ConnectionError
转化为code = 14, msg = ConnectionError.Desc
的 status - 优化 gRPC server 侧调用 streaming.Recv/Send 返回的错误,当流被关闭时可以获取到真正的原因而不是"context is canceled"
- 对于流式调用串联场景 A -> B -> C,A B 间的错误让 ctx 被 cancel,使得 B C 间的调用出错。给错误字符串加上 "[triggered by handler side]"、"[triggered by remote service]" 来更好地提示用户
- 为 gRPC 异常情况下发送 RstStream Frame 的场景加上日志