-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
embed: stop *grpc.Server on *serveCtx serve error #8992
Conversation
can we add a test case to cover this? |
@xiang90 It's hard unless we refactor embed package to break it down to smaller pieces. In integration tests, I tried triggering failure to this path by passing nil Another way that |
Codecov Report
@@ Coverage Diff @@
## master #8992 +/- ##
==========================================
- Coverage 76.03% 75.96% -0.07%
==========================================
Files 359 359
Lines 29819 29825 +6
==========================================
- Hits 22672 22656 -16
- Misses 5563 5585 +22
Partials 1584 1584
Continue to review full report at Codecov.
|
embed/serve.go
Outdated
@@ -101,6 +101,7 @@ func (sctx *serveCtx) serve( | |||
opts := []grpc.DialOption{grpc.WithInsecure()} | |||
gwmux, err := sctx.registerGateway(opts) | |||
if err != nil { | |||
gs.Stop() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably make error as named return. and we always try to stop gs if it is not nil
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
If serve errors before *grpc.Server is sent to serversC, it should be closed manually. Signed-off-by: Gyuho Lee <[email protected]>
lgtm |
I forgot to handle this in #8987.
If serve errors before *grpc.Server is sent to serversC,
it should be closed manually.
@xiang90