-
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
Socket activated grpc service restarts after GracefulStop() #4272
Comments
Your setup seems to be quite involved. We are not best placed to comment on interactions with systemd. If you could simplify your setup and just have a grpc client+server (without systemd) and point us to a problem that you see, we would be happy to take a look at. |
@easwars: The issue there is that systemd is what will restart the service with socket activation, hence we can’t remove it from the tests or you won’t see the restarting effect by itself. |
One thing to try is to turn on logs: https://github.com/grpc/grpc-go#how-to-turn-on-logging |
OK. I will close this one then. Let's track in the new issue. |
What version of gRPC are you using?
github.com/golang/protobuf v1.4.2 // indirect
google.golang.org/grpc v1.36.0 // indirect
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 // indirect
google.golang.org/protobuf v1.25.0 // indirect
What version of Go are you using (
go version
)?go version go1.16 linux/amd64
What operating system (Linux, Windows, …) and version?
Linux (Ubuntu) hirsute (devel series, incoming 21.04)
What did you do?
See our minimal reproducer test case at https://github.com/ubuntu/grpcstop:
Then:
Scenario 1. a call to
grpcstop stop
activates and then stops as expected the service (without any error), but this one restarts immediately then (different pid for the server process)Scenario 2. a call to
grpcstop wait
activates the service, then a call togrpcstop stop
exits immediately and the service is still waiting. Once the timeout is over, the server quits as expected, but also restarts immediately.Note: this isn’t reproduceable 100%, but a good 70% of tests shows up the restarting behaviour. It seems the slower the machine (like a vm), the more you get this issue.
This sounds like there are still some messages on the unix socket that are not drained by GracefulStop() and thus, systemd restarts the service.
The code available at https://github.com/ubuntu/grpcstop/blob/main/main.go#L43 contains both minimal server and client.
systemd output:
What did you expect to see?
What did you see instead?
Minimal test case to reproduce
To reproduce with our minimal test case at https://github.com/ubuntu/grpcstop:
go generate
) and go build./tmp/grpcstop
$ systemctl daemon-reload
$ systemctl enable grpcstop.socket
$ systemctl start grpcstop.socket
systemd.log_level=debug
to the boot command line of the test machine and restarting the machine.Scenario 1:
grpcstop stop
Scenario 2:
grpcstop wait
in one terminal.-> The grpcstop service is activated.
grpcstop stop
in another terminal while the wait command is still running.-> the stop command exits immediately
-> the grpcstop service is stopped once the wait command exit, but then, it is restarted (different pid)
The text was updated successfully, but these errors were encountered: