-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Gateway server panics on invalid Grpc-Timeout value #2822
Comments
johanbrandhorst
added a commit
that referenced
this issue
Jul 30, 2022
This will fix #2822 for users who only update their runtime
johanbrandhorst
added a commit
that referenced
this issue
Jul 30, 2022
This will fix #2822 for users who only update their generator
Merged
Thank you for this bug report. I consider this a very bad bug so I've gone ahead and submitted a double fix myself in #2823. |
johanbrandhorst
added a commit
that referenced
this issue
Jul 30, 2022
This will fix #2822 for users who only update their generator
johanbrandhorst
added a commit
that referenced
this issue
Jul 30, 2022
We've released a fix for this in https://github.com/grpc-ecosystem/grpc-gateway/releases/tag/v2.11.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
🐛 Bug Report
Server panics when receives request with invalid Grpc-Timeout value.
Let's consider following code from example:
grpc-gateway/examples/internal/proto/examplepb/echo_service.pb.gw.go
Lines 905 to 909 in 1911ac0
runtime.AnnotateIncomingContext
may returnctx == nil
iferr != nil
.But then ctx is passed into
runtime.HTTPError(ctx, ...)
, which in default case callsruntime.DefaultHTTPErrorHandler(ctx, ...)
, which callsServerMetadataFromContext(ctx)
.The latter tries to get value from that context and panics, given that the context is nil.
grpc-gateway/runtime/context.go
Lines 185 to 188 in 1911ac0
To Reproduce
go run examples/internal/cmd/example-grpc-server/main.go
go run examples/internal/cmd/example-gateway-server/main.go
Server log:
Expected behavior
Server should return error like that:
Actual Behavior
Server panics, no response returned.
Your Environment
macOS 12.4
go version go1.18.4 darwin/arm64
repo revision 1911ac0
The text was updated successfully, but these errors were encountered: