-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
streams: Stop cleaning up after orphaned streams #1854
Conversation
Reviewed 6 of 6 files at r1. clientconn.go, line 1384 at r1 (raw file):
Why is this error moved here? stream.go, line 131 at r1 (raw file):
What does this mean? Also move the comment to where stream.go, line 419 at r1 (raw file):
stream.go, line 421 at r1 (raw file):
So we will call finish() with stream.go, line 491 at r1 (raw file):
Add comment why we don't care the returned error. stats/stats_test.go, line 1228 at r1 (raw file):
Also delete test/end2end_test.go, line 1167 at r1 (raw file):
Should we send multiple times and expect test/end2end_test.go, line 3800 at r1 (raw file):
Consider also Comments from Reviewable |
Review status: all files reviewed at latest revision, 8 unresolved discussions. clientconn.go, line 1384 at r1 (raw file): Previously, menghanl (Menghan Li) wrote…
I was tired of looking at it. I'd delete it, but it's possible it would break somebody, so I don't think we should (and it's harmless). stream.go, line 131 at r1 (raw file): Previously, menghanl (Menghan Li) wrote…
PTAL stream.go, line 419 at r1 (raw file): Previously, menghanl (Menghan Li) wrote…
I can do this, but it needs an explicit finish() call below in that case, too, because the defer can only finish() on error. Changed to reflect. It's maybe cleaner because the special-case stuff is closer together now? stream.go, line 421 at r1 (raw file): Previously, menghanl (Menghan Li) wrote…
Yes, that's fine. finish() converts io.EOF to nil anyway. stream.go, line 491 at r1 (raw file): Previously, menghanl (Menghan Li) wrote…
Done stats/stats_test.go, line 1228 at r1 (raw file): Previously, menghanl (Menghan Li) wrote…
Done. test/end2end_test.go, line 1167 at r1 (raw file): Previously, menghanl (Menghan Li) wrote…
Done. test/end2end_test.go, line 3800 at r1 (raw file): Previously, menghanl (Menghan Li) wrote…
I had a defer here once, where did it go? Re-added. Comments from Reviewable |
Reviewed 3 of 3 files at r2. Comments from Reviewable |
gRPC introduced some behavioral changes that broke OpenCensus support for streaming outgoing calls. See grpc/grpc-go#1854. In the case of a failed response, gRPC doesn't call the stats handler with the stats.End message. Given we cannot recieve the end message, we cannot finish the client span started for the streaming request. Skip this test until we figure out whether we are implementing the streaming protocol properly or gRPC introduced a bug.
gRPC introduced some behavioral changes that broke OpenCensus support for streaming outgoing calls. See grpc/grpc-go#1854. In the case of a failed response, gRPC doesn't call the stats handler with the stats.End message. Given we cannot recieve the end message, we cannot finish the client span started for the streaming request. Skip this test until we figure out whether we are implementing the streaming protocol properly or gRPC introduced a bug.
gRPC introduced some behavioral changes that broke OpenCensus support for streaming outgoing calls. See grpc/grpc-go#1854. In the case of a failed response, gRPC doesn't call the stats handler with the stats.End message. Given we cannot recieve the end message, we cannot finish the client span started for the streaming request. Skip this test until we figure out whether we are implementing the streaming protocol properly or gRPC introduced a bug.
@dfawley Could you please clarify if the example of client-side streaming is following the proper stream protocol? Because https://github.com/grpc/grpc-go/blob/master/examples/route_guide/client/client.go#L59 |
@vitalyisaev2 Thanks for pointing this out! The route_guide example does
Using I also filed #1878 to check other |
@menghanl thank you, now examples look much more idiomatic. |
This change introduces some behavior changes that should not impact users that are following the proper stream protocol. Specifically, one of the following conditions must be satisfied:
Close
on theClientConn
.NewClientStream
, or its deadline expires. (Note that it if the context is no longer needed before the deadline expires, it is still recommended to callcancel
to prevent bloat.) It is always recommended to cancel contexts when they are no longer needed, and to never use the background context directly, so all users should always be doing this.RecvMsg
(orRecv
in generated code) until a non-nil error is returned.Header
orSendMsg
(orSend
in generated code) besidesio.EOF
.If none of the above happen, this will leak a goroutine and a context, and grpc will not call the optionally-configured stats handler with a
stats.End
message.Before this change, if a user created a stream and the server ended the stream, the stats handler would be invoked with a
stats.End
containing the final status of the stream. Subsequent calls toRecvMsg
would then trigger the stats handler withInPayload
s, which may be unexpected by stats handlers.This change is