Skip to content
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

[Flatbuffers codec] Content-subtype only set for go lang #4213

Closed
mustiikhalil opened this issue Feb 18, 2021 · 5 comments · Fixed by #4218
Closed

[Flatbuffers codec] Content-subtype only set for go lang #4213

mustiikhalil opened this issue Feb 18, 2021 · 5 comments · Fixed by #4218

Comments

@mustiikhalil
Copy link

mustiikhalil commented Feb 18, 2021

Hello,

I am working on updating the flatbuffers Grpc support to v1.35.0 for all the languages that are implemented. However I am facing a small issue, whenever I try to make different languages communicate the go server would usually crash. Since I was told all the other languages actually ignore the appended suffix into the application/grpc+{custom} where custom is usually removed. I've dig into the code and found out that processHeaderField func has a comment about how it might be better if it was switched to (subtype).

A suggested solution might be; checking for a content-subtype within f hpack.HeaderField and if present use that as a codec type/subtype, this can be set by the user as a custom metadata. and if its not it can default back to the content-type

It would be really nice to allow the go lang server to communicate with other Flatbuffers implemented clients.

Things I've tried:

  • Communicating with the go server from the following implementations; JS, python, swift.
  • Setting them separately in the languages but that just always gets ignored.
@menghanl
Copy link
Contributor

whenever I try to make different languages communicate the go server would usually crash

Can you provide more details of how you ran the client/server, and the error you saw on each side?

@mustiikhalil
Copy link
Author

mustiikhalil commented Feb 18, 2021

Sorry, it seems that it's an issue with the core lib, not setting the custom suffix

@menghanl
Copy link
Contributor

The root cause might be core not setting custom suffix, but a panic in the go server should never happen.

Do you have more information of where the panic happened? Can you paste the full stacktrace? Thanks.

@menghanl menghanl reopened this Feb 18, 2021
@mustiikhalil
Copy link
Author

:scheme http
:method POST
:authority localhost:3000
:path /models.Greeter/SayHello
from ts
te trailers
content-type application/grpc
user-agent grpc-node/1.24.5 grpc-c/8.0.0 (osx; chttp2; ganges)
grpc-accept-encoding identity,deflate,gzip
accept-encoding identity,gzip
----
panic: interface conversion: *models.HelloRequest is not protoiface.MessageV1: missing method ProtoMessage

goroutine 12 [running]:
google.golang.org/grpc/encoding/proto.codec.Unmarshal(...)
        /Users/silly/go/pkg/mod/google.golang.org/[email protected]/encoding/proto/proto.go:43
google.golang.org/grpc.(*Server).processUnaryRPC.func2(0x146e3e0, 0xc0002040a0, 0x30, 0x14aa2c0)
        /Users/silly/go/pkg/mod/google.golang.org/[email protected]/server.go:1194 +0xd9
github.com/google/flatbuffers/grpc/examples/go/greeter/models._Greeter_SayHello_Handler(0x146f760, 0x1839340, 0x156f760, 0xc00020e000, 0xc0002022a0, 0x0, 0x156f760, 0xc00020e000, 0xc00020c000, 0x20)
        /Users/silly/development/flatbuffers/grpc/examples/go/greeter/models/Greeter_grpc.go:105 +0x53
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0000f6fc0, 0x1573ce0, 0xc0001ca000, 0xc0001cc000, 0xc0001a0930, 0x17f6240, 0x0, 0x0, 0x0)
        /Users/silly/go/pkg/mod/google.golang.org/[email protected]/server.go:1217 +0x522
google.golang.org/grpc.(*Server).handleStream(0xc0000f6fc0, 0x1573ce0, 0xc0001ca000, 0xc0001cc000, 0x0)
        /Users/silly/go/pkg/mod/google.golang.org/[email protected]/server.go:1540 +0xd05
google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc000026f14, 0xc0000f6fc0, 0x1573ce0, 0xc0001ca000, 0xc0001cc000)
        /Users/silly/go/pkg/mod/google.golang.org/[email protected]/server.go:878 +0xa5
created by google.golang.org/grpc.(*Server).serveStreams.func1
        /Users/silly/go/pkg/mod/google.golang.org/[email protected]/server.go:876 +0x1fd
exit status 2

This should be the full trace I am getting out of the console.

@mustiikhalil
Copy link
Author

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants