Add gRPC error interceptors to API client#30578
Conversation
3efb8e3 to
a7d10e2
Compare
codingllama
left a comment
There was a problem hiding this comment.
Many thanks!
Let's make sure we backport this, so other backported code won't work under the wrong assumptions.
4f5c4dc to
9a32e65
Compare
rosstimothy
left a comment
There was a problem hiding this comment.
I added similar behavior in #25694 and then reverted it in #26169. It inadvertently broke tsh request ls and caused error traces to be rooted at the interceptor instead of the client. So instead of something which showed exactly where the error came from like the following
ERROR REPORT:
Original Error: *trace.TraceErr EOF
Stack Trace:
github.com/gravitational/teleport/api/client/client.go:875 github.com/gravitational/teleport/api/client.(*Client).GetAccessRequests
github.com/gravitational/teleport/tool/tsh/access_request.go:55 main.onRequestList.func1
github.com/gravitational/teleport/lib/client/api.go:1395 github.com/gravitational/teleport/lib/client.(*TeleportClient).WithRootClusterClient
github.com/gravitational/teleport/tool/tsh/access_request.go:54 main.onRequestList
github.com/gravitational/teleport/tool/tsh/tsh.go:1215 main.Run
github.com/gravitational/teleport/tool/tsh/tsh.go:506 main.main
runtime/proc.go:250 runtime.main
runtime/asm_arm64.s:1172 runtime.goexit
User Message: EOF
we would get something like this instead
ERROR REPORT:
Original Error: *trace.TraceErr EOF
Stack Trace:
github.com/gravitational/teleport/api/utils/grpc/interceptors:55 github.com/gravitational/teleport/api/utils/grpc/interceptors.(* grpcClientStreamWrapper).RecvMsg
github.com/gravitational/teleport/tool/tsh/access_request.go:55 main.onRequestList.func1
github.com/gravitational/teleport/lib/client/api.go:1395 github.com/gravitational/teleport/lib/client.(*TeleportClient).WithRootClusterClient
github.com/gravitational/teleport/tool/tsh/access_request.go:54 main.onRequestList
github.com/gravitational/teleport/tool/tsh/tsh.go:1215 main.Run
github.com/gravitational/teleport/tool/tsh/tsh.go:506 main.main
runtime/proc.go:250 runtime.main
runtime/asm_arm64.s:1172 runtime.goexit
User Message: EOF
|
@rosstimothy is not trace-wrapping in the interceptors enough to avoid it? Any tips to avoid making the same mistakes? |
If we don't do a |
|
@rosstimothy How did your PR break Also, Alan is right, we just need to |
7ac6a5a to
76a143d
Compare
e0e0490 to
5f869dc
Compare
|
Adding this comment here to record the history. Since the interceptors landed various server-side errors that used to be treated as status.Error are now trace.BadParameter errors, which triggers relogin in various situations where it shouldn't. See #36749 and #36866 (comment). |
Moves the gRPC error interceptors to
api/utils/grpc/interceptorsand uses them in the API client.In a follow up PR, after https://github.com/gravitational/teleport.e/pull/2007 is merged, the alias functions in
lib/utils/grpc.gowill be removed.