-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
streams: Stop cleaning up after orphaned streams (#1854)
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: 1. The user calls Close on the ClientConn. 2. The user cancels the context provided to NewClientStream, or its deadline expires. (Note that it if the context is no longer needed before the deadline expires, it is still recommended to call cancel 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. 3. The user calls RecvMsg (or Recv in generated code) until a non-nil error is returned. 4. The user receives any error from Header or SendMsg (or Send in generated code) besides io.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 to RecvMsg would then trigger the stats handler with InPayloads, which may be unexpected by stats handlers.
- Loading branch information
Showing
6 changed files
with
123 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.