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

Cannot get Go GRPC client talking to C++ server #1120

Closed
rosun82 opened this issue Mar 12, 2017 · 1 comment · Fixed by #1123
Closed

Cannot get Go GRPC client talking to C++ server #1120

rosun82 opened this issue Mar 12, 2017 · 1 comment · Fixed by #1123

Comments

@rosun82
Copy link

rosun82 commented Mar 12, 2017

Hi All,

I am trying to let a Go client talk to C++ server on the very simple "greeting" example. I got

  1. Go server talks to Go client

  2. C++ server talks to C++ client

  3. Go server talks to C++ client

But, C++ server does not talk to Go client : (

It seems that there is something weird about the request, in particular the "grpc-encoding" section.

Go:

D0312 12:48:55.811738475 9876 tcp_posix.c:173] READ 0x7f65a8000b30 (peer=ipv4:127.0.0.1:53510): 50 52 49 20 2a 20 48 54 54 50 2f 32 2e 30 0d 0a 0d 0a 53 4d 0d 0a 0d 0a 00 00 00 04 00 00 00 00 00 00 00 04 08 00 00 00 00 00 00 0e ff f1 00 00 44 01 04 00 00 00 01 83 86 44 96 62 6b 0a 54 9a a9 97 c5 61 4a 93 55 36 e2 d9 dc c4 2b 18 ac 29 53 41 86 a0 e4 1d 13 9d 09 5f 8b 1d 75 d0 62 0d 26 3d 4c 4d 65 64 7a 88 9a ca c8 b4 c7 60 2b 83 40 02 74 65 86 4d 83 35 05 b1 1f 00 00 13 00 01 00 00 00 01 00 00 00 00 0e 0a 0c 53 61 6e 74 61 20 42 61 62 61 72 61 00 00 00 04 01 00 00 00 00 'PRI * HTTP/2.0....SM............................D........D.bk.T....aJ.U6....+..)SA......._..u.b.&=LMedz......`+.@.te.M.5...................Santa Babara.........'

I0312 12:48:55.811819310 9876 parsing.c:659] HTTP:1:HDR:SVR: :method: POST
I0312 12:48:55.811827855 9876 parsing.c:659] HTTP:1:HDR:SVR: :scheme: http
I0312 12:48:55.811836226 9876 parsing.c:659] HTTP:1:HDR:SVR: :path: /greeting.GreetingService/Greet
I0312 12:48:55.811846319 9876 parsing.c:659] HTTP:1:HDR:SVR: :authority: localhost
I0312 12:48:55.811850169 9876 parsing.c:659] HTTP:1:HDR:SVR: content-type: application/grpc
I0312 12:48:55.811857770 9876 parsing.c:659] HTTP:1:HDR:SVR: user-agent: grpc-go/1.0
I0312 12:48:55.811862711 9876 parsing.c:659] HTTP:1:HDR:SVR: te: trailers

C++

D0312 12:49:09.274579174 9877 tcp_posix.c:173] READ 0x7f65a0000c20 (peer=ipv4:127.0.0.1:53514): 50 52 49 20 2a 20 48 54 54 50 2f 32 2e 30 0d 0a 0d 0a 53 4d 0d 0a 0d 0a 00 00 18 04 00 00 00 00 00 00 02 00 00 00 00 00 03 00 00 00 00 00 04 00 00 ff ff 00 06 00 00 40 00 00 00 04 08 00 00 00 00 00 00 0f 00 01 00 01 10 01 04 00 00 00 01 40 07 3a 73 63 68 65 6d 65 04 68 74 74 70 40 07 3a 6d 65 74 68 6f 64 04 50 4f 53 54 40 05 3a 70 61 74 68 1f 2f 67 72 65 65 74 69 6e 67 2e 47 72 65 65 74 69 6e 67 53 65 72 76 69 63 65 2f 47 72 65 65 74 40 0a 3a 61 75 74 68 6f 72 69 74 79 0e 6c 6f 63 61 6c 68 6f 73 74 3a 38 30 38 30 40 0d 67 72 70 63 2d 65 6e 63 6f 64 69 6e 67 08 69 64 65 6e 74 69 74 79 40 14 67 72 70 63 2d 61 63 63 65 70 74 2d 65 6e 63 6f 64 69 6e 67 15 69 64 65 6e 74 69 74 79 2c 64 65 66 6c 61 74 65 2c 67 7a 69 70 40 02 74 65 08 74 72 61 69 6c 65 72 73 40 0c 63 6f 6e 74 65 6e 74 2d 74 79 70 65 10 61 70 70 6c 69 63 61 74 69 6f 6e 2f 67 72 70 63 40 0a 75 73 65 72 2d 61 67 65 6e 74 35 67 72 70 63 2d 63 2b 2b 2f 31 2e 30 2e 31 2d 70 72 65 31 20 67 72 70 63 2d 63 2f 31 2e 30 2e 31 2d 70 72 65 31 20 28 6c 69 6e 75 78 3b 20 63 68 74 74 70 32 29 00 00 04 08 00 00 00 00 01 00 00 ff ff 00 00 13 00 01 00 00 00 01 00 00 00 00 0e 0a 0c 53 61 6e 74 61 20 42 61 62 61 72 61 00 00 00 04 01 00 00 00 00 'PRI * HTTP/2.0....SM...................................@.......................@.:scheme.http@.:method.POST@.:path./greeting.GreetingService/Greet@.:authority.localhost:8080@.grpc-encoding.identity@.grpc-accept-encoding.identity,deflate,gzip@.te.trailers@.content-type.application/grpc@.user-agent5grpc-c++/1.0.1-pre1 grpc-c/1.0.1-pre1 (linux; chttp2).............................Santa Babara.........'

I0312 12:49:09.274692870 9877 parsing.c:659] HTTP:1:HDR:SVR: :scheme: http
I0312 12:49:09.274703976 9877 parsing.c:659] HTTP:1:HDR:SVR: :method: POST
I0312 12:49:09.274715408 9877 parsing.c:659] HTTP:1:HDR:SVR: :path: /greeting.GreetingService/Greet
I0312 12:49:09.274726492 9877 parsing.c:659] HTTP:1:HDR:SVR: :authority: localhost:8080
I0312 12:49:09.274734959 9877 parsing.c:659] HTTP:1:HDR:SVR: grpc-encoding: identity
I0312 12:49:09.274745969 9877 parsing.c:659] HTTP:1:HDR:SVR: grpc-accept-encoding: identity,deflate,gzip
I0312 12:49:09.274758047 9877 parsing.c:659] HTTP:1:HDR:SVR: te: trailers
I0312 12:49:09.274767995 9877 parsing.c:659] HTTP:1:HDR:SVR: content-type: application/grpc
I0312 12:49:09.274772813 9877 parsing.c:659] HTTP:1:HDR:SVR: user-agent: grpc-c++/1.0.1-pre1 grpc-c/1.0.1-pre1 (linux; chttp2)

Looks like the C++ client always send grpc-encoding and grpc-accept-encoding, while the Go client does not send these. I am not sure whether this is the cause of the problem.

Would any one please take a look?

Thanks

@rosun82
Copy link
Author

rosun82 commented Mar 13, 2017

Resolved. It turns out that Go gRPC sets :authority different than C++ client.

The C++ client by default set :authority to be the server + port, e.g., "localhost:8080", while
the go server sets just "localhost", without the port.

When setting up C++ server using RegisterService(host, &service), the host would match C++ :authority, but not the Go one, causing the server throw back UNIMPLEMENTED error.

Is it possible to make Go also set :authority to be exactly the same as host to avoid this problem?

@menghanl menghanl added the 1.1 label Mar 13, 2017
@menghanl menghanl moved this from Backlog to In Review in 1.2 Release [2017-Mar-20] Mar 14, 2017
@lock lock bot locked as resolved and limited conversation to collaborators Sep 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants