Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to figure out which rpc method is throwing an error logged in the ClientErrorDelegate #1631

Open
CarlosNano opened this issue Jul 18, 2023 · 2 comments
Labels
kind/support Adopter support requests.

Comments

@CarlosNano
Copy link

What are you trying to achieve?

I'm connecting to multiple rpc methods, some are streams and some are not.

Sometimes when I connect to these streams I've got errors in the ClientErrorDelegate, but I can't figure out which rpc is trowing the error.

So I've got two ways of logging the errors:

  • When I create the request for each rpc: If I get an error here I would know which one is giving me the error.

  • Using the ClientErrorDelegate When I create the service client and and I create the class that provides the channel, I create a logger and I use this class as ClientErrorDelegate:

 var logger = Logger(label: "gRPC", factory: StreamLogHandler.standardOutput(label:))

So in my class I use the extension to log the errors:

extension ClientErrorDelegate {
    
    func didCatchError(_ error: Error, logger: Logger, file: StaticString, line: Int) {
        print("didCatchError, error: \(error), logger: \(logger), StaticString:\(file), line: \(line)")
    }
}

One of the example of this type of error is the following one:

didCatchError, error: handshakeFailed(NIOSSL.BoringSSLError.sslError([Error:  EOF during handshake]))

Is there any way in the delegate to know which method is throwing the error? How come these type of errors are not thrown in the response of the rpc method?

Thanks

@CarlosNano CarlosNano added the kind/support Adopter support requests. label Jul 18, 2023
@Lukasa
Copy link
Collaborator

Lukasa commented Jul 18, 2023

These errors aren't thrown in the response of the RPC method because grpc-swift abstracts away connection creation. This error is considered non-terminal: it is possible that it will resolve itself, and grpc-swift is going to keep retrying. To throw the error would require us to terminate the RPC, which is not necessary.

Similarly, this error is not associated with one RPC, but all of them: as the connection hasn't come up, none of the RPCs can progress. RPCs are multiplexed onto one connection.

@CarlosNano
Copy link
Author

CarlosNano commented Jul 19, 2023

I see, thanks for the response and the extra detail.

I've noticed that sometime I get this error ( a little bit randomly ) and after getting it, grpc retry and returns the response.

What would you suggest is the best way to debug this type of errors? Which classes should I be taking a look first?

Also can the settings for retrying being changed in order to retry more often? It would be awesome if the retry settings can be adjusted to the type of error ( maybe... :) )

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/support Adopter support requests.
Projects
None yet
Development

No branches or pull requests

2 participants