-
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
calling Server.GracefulStop causes "accept tcp host:port: use of closed network connection" #848
Comments
I see that the example does not even stops the server properly. The onboarding experience with this creates some kind of uncertainty with See https://github.com/grpc/grpc-go/blob/master/examples/route_guide/server/server.go#L238 |
This typically means your server has been stopped (e.g., Line 63 in 3838369
In the example, we do not stop the server for simplicity. In production, server stop code typically stays in the signal handler. |
I do not stop the server before starting it. Why should somebody do that actually? Anyway, the "problem" here is that you stop a server and you get an error no matter what you do. I figured out that it is because of the
So my explanation would be that the I guess you cannot do anything about this. Anyway it is really odd because users start to ignore errors like this because errors are thrown even nothing was actually wrong. In worst cases this leads to ignoring root causes of serious problems. |
we will rework on grpclog so that this kind of error/warning won't be thrown out unless it is under debugging mode. |
when the Server.GracefulStop() was celled, all connection from client will be closed, even which was waiting server-side to handling the request. when the server finish the request, it found the tcp-connection was closed. It not Graceful at all. The best way was close the idle connection.
|
@toontong In this case, the server sends the response back and finds there is no pending rpc. Now the server closes all its connections, which is the reason this log is generated -- that goroutine is doing a blocking read from the socket which was just closed by the server. GracefulStop is graceful. |
What is best way to deal with this error? Should we add a field to Server to make it knows that it has been graceful shutdown? and if the error is "use of closed network connection", we should just ignore it and return |
IMO we should reach out to the go developers and hear what they think. This issue should probably not be solved in |
@xh3b4sd can you explain why you think it is a problem with go, not grpc-go? |
In my former comment I pointed out that the error comes from https://golang.org/pkg/net/#Listener, which documentation puts this:
So why should something produce an error when I request it to stop any action? Errors indicate faulty behaviour. When I make proper use of the |
Maybe I understand something wrongs, but the error returns when we call |
I understood it this way that you call |
@xh3b4sd do you still feel that this is something that should be solved in grpc-go or are you leaning toward having this resolved in the core |
I do not mind. I am super off this issue at the moment to be honest. If only I have issues, then lets close it. At the moment I am not bothered anymore by it. I think it should be fixed though. I am only not able to invest time into the how and actual doing at the moment. Thanks for asking anyway. |
I am going to close this issue out for now, if you hit this again and you feel this is something grpc-go should resolve, please reopen. Thanks for filing the issue! |
When starting and stopping the gRPC server gracefully using Server.GracefulStop I noticed the following error.
This error does not occur when only calling Server.Stop.
The text was updated successfully, but these errors were encountered: