ocaml-grpc icon indicating copy to clipboard operation
ocaml-grpc copied to clipboard

Detecting closed stream

Open crackcomm opened this issue 1 year ago • 4 comments

Currently the server keeps writing even after the client closes the connection.

I'm not sure if it's even possible to detect it.

crackcomm avatar Jun 13 '24 04:06 crackcomm

Cześć Łukasz, yes it is possible to detect it. I will test if the current rewrite in grpc-eio-noseq already handles that case.

One adjacent aspect of this, however, is handling of GOAWAY frames. https://github.com/anmonteiro/ocaml-h2/issues/240 https://github.com/anmonteiro/ocaml-h2/issues/241

This will further improve the ergonomics and bring this library closer to feature parity with Google's libs (ironically the best implementation of this behavior can be found in a GitHub issue ~https://github.com/grpc/grpc-go/issues/6019~ this is not the issue, I cannot find it but tldr; streams are closed on the second go away, the first one is to begin graceful shutdown procedure)

wokalski avatar Jun 13 '24 06:06 wokalski

Do you know how we can detect this? I tried calling Body.Writer.is_closed on a writer returned by respond_with_streaming, but it was never actually true until Body.Writer.close was called by returning from the handler.

crackcomm avatar Jun 27 '24 20:06 crackcomm

@wokalski is grpc-eio-noseq the branch you're using with eio? I'm wondering if it's running in production and I can just plug and play?

crackcomm avatar Nov 22 '24 14:11 crackcomm

It is the one from robot rewrite. There are some bugs around codegen paths in arpaca but other than that it should be solid

wokalski avatar Nov 22 '24 14:11 wokalski