jgaskins / grpc

Pure-Crystal implementation of gRPC
MIT License
77 stars 12 forks source link

Server Doesn't Receive Messages For Clients on 1.60 #10

Closed bendangelo closed 9 months ago

bendangelo commented 10 months ago

I just tried this which a quick ruby implementation and no messages are received by the server.

For ref: https://rubygems.org/gems/grpc/versions/1.60.0-x86_64-darwin

jgaskins commented 9 months ago

I was able to reproduce this. It looks like when the HTTP/2 frame is received here, the stream never reached the half_closed_remote state — where the client has sent the request and is awaiting the response.

I'm not sure what changed along the way. The Ruby gem is what I built this shard against and I haven't made any changes to the HTTP/2 stuff since. I originally tested the Crystal server with the Ruby client and the Crystal client against the Ruby server.

I found the problem, though. It looks like at some point the Ruby client was updated to expect the server to send a SETTINGS frame. It wasn't sending the request (or even the headers) until it received it. This shard probably should have sent that frame (I had already added it to the client 😄) but it used to work without it.

I went ahead and fixed it in https://github.com/jgaskins/grpc/commit/71f9c10439944281283f08cfd00bd3ec6dd993ec (this part specifically). Feel free to check and see if it works. Note that you'll also need to rerun protoc to generate your files after you run shards update grpc because while debugging this I also found and fixed a namespace issue in https://github.com/jgaskins/grpc/commit/5b192679d623f90107a5648e8693add34f69a8f4. I also opened #11 because I discovered the same blocking condition happens after a little over 6000 frames. I'll see if I can get some time this week to work on that.

bendangelo commented 9 months ago

Thanks for the fix! I'll test it out when I can