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

Proper shutdown of HTTP2 encoder when channelInactive #3961

Closed
wants to merge 2 commits into from

Conversation

nmittler
Copy link
Member

@nmittler nmittler commented Jul 8, 2015

Motivation:

The problem is described in grpc/grpc-java#605. Basically, when using StreamBufferingEncoder there is a chance of creating zombie streams that never get closed.

Modifications:

Change Http2ConnectionHandler's channelInactive handling logic to shutdown the encoder/decoder before shutting down the active streams.

Result:

Fixes grpc/grpc-java#605

Motivation:

The problem is described in grpc/grpc-java#605. Basically, when using `StreamBufferingEncoder` there is a chance of creating zombie streams that never get closed.

Modifications:

Change `Http2ConnectionHandler`'s `channelInactive` handling logic to shutdown the encoder/decoder before shutting down the active streams.

Result:

Fixes grpc/grpc-java#605
@nmittler
Copy link
Member Author

nmittler commented Jul 8, 2015

@Scottmitch @louiscryan PTAL

* Thrown if buffered streams are terminated due to this encoder being closed.
*/
public static final class ChannelClosedException extends Http2Exception {
public ChannelClosedException() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add serialVersionUID?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@Scottmitch
Copy link
Member

@nmittler - Just 1 small comment...and fix build failure...then lgtm.

@Scottmitch Scottmitch added this to the 4.1.0.Beta6 milestone Jul 8, 2015
@@ -127,6 +139,10 @@ public ChannelFuture writeHeaders(ChannelHandlerContext ctx, int streamId, Http2
public ChannelFuture writeHeaders(ChannelHandlerContext ctx, int streamId, Http2Headers headers,
int streamDependency, short weight, boolean exclusive,
int padding, boolean endOfStream, ChannelPromise promise) {
if (closed) {
promise.setFailure(new ChannelClosedException());
return promise;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge the two lines... return promise.setFailure(....)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@nmittler
Copy link
Member Author

nmittler commented Jul 8, 2015

@normanmaurer anything else or shall I cherry-pick?

@Scottmitch
Copy link
Member

@nmittler - LGTM!

@nmittler
Copy link
Member Author

nmittler commented Jul 9, 2015

Cherry-picked into master (8a16081) and 4.1 (6e044b0)

@nmittler nmittler closed this Jul 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants