-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
wrong error logging #2059
Comments
This function ( That said, it's not useful to log (especially as an error) things that are normal termination conditions. We should update this accordingly. What you've done looks mostly OK. I have two concerns: The first is that you don't call func YourFunction() (err error) {
conn, err := grpc.Dial(...)
if err != nil {
return err
}
defer func() {
closeErr := conn.Close()
if err == nil {
// Otherwise, we will return the primary error and ignore the error from Close.
err = closeErr
}
}()
... The second is that you have used ctx, cancel := context.WithDeadline(context.Background(), 5*time.Second)
// or ctx, cancel := context.WithCancel(context.Background())
defer cancel() Failure to cancel the context, or One last note is that |
I add |
As another datapoint. This has flooded our logs after updating to the latest gRPC. The reason for this is that we have a cronjob that connects to the process. We have now disabled all logging for gRPC because of this. |
Created a fix. |
Please answer these questions before submitting your issue.
What version of gRPC are you using?
master
What version of Go are you using (
go version
)?go version go1.10 linux/amd64
What operating system (Linux, Windows, …) and version?
linux
What did you do?
i have an reflection client and server. i make a simple request
on server i have error log like
this message would be print even if err is
nil
. https://github.com/grpc/grpc-go/blob/master/transport/controlbuf.go#L371Anyway i would to ask - is it a proper way to close connection?
The text was updated successfully, but these errors were encountered: