File tree Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -738,14 +738,19 @@ public void operationComplete(ChannelFuture future) throws Exception {
738
738
739
739
// Attach the client stream to the HTTP/2 stream object as user data.
740
740
stream .setHttp2Stream (http2Stream );
741
+ promise .setSuccess ();
742
+ } else {
743
+ // Otherwise, the stream has been cancelled and Netty is sending a
744
+ // RST_STREAM frame which causes it to purge pending writes from the
745
+ // flow-controller and delete the http2Stream. The stream listener has already
746
+ // been notified of cancellation so there is nothing to do.
747
+ //
748
+ // This process has been observed to fail in some circumstances, leaving listeners
749
+ // unanswered. Ensure that some exception has been delivered consistent with the
750
+ // implied RST_STREAM result above.
751
+ Status status = Status .INTERNAL .withDescription ("unknown stream for connection" );
752
+ promise .setFailure (status .asRuntimeException ());
741
753
}
742
- // Otherwise, the stream has been cancelled and Netty is sending a
743
- // RST_STREAM frame which causes it to purge pending writes from the
744
- // flow-controller and delete the http2Stream. The stream listener has already
745
- // been notified of cancellation so there is nothing to do.
746
-
747
- // Just forward on the success status to the original promise.
748
- promise .setSuccess ();
749
754
} else {
750
755
Throwable cause = future .cause ();
751
756
if (cause instanceof StreamBufferingEncoder .Http2GoAwayException ) {
Original file line number Diff line number Diff line change @@ -268,7 +268,7 @@ public void cancelBufferedStreamShouldChangeClientStreamStatus() throws Exceptio
268
268
// Cancel the stream.
269
269
cancelStream (Status .CANCELLED );
270
270
271
- assertTrue (createFuture .isSuccess ());
271
+ assertFalse (createFuture .isSuccess ());
272
272
verify (streamListener ).closed (eq (Status .CANCELLED ), same (PROCESSED ), any (Metadata .class ));
273
273
}
274
274
@@ -311,7 +311,7 @@ public void cancelWhileBufferedShouldSucceed() throws Exception {
311
311
ChannelFuture cancelFuture = cancelStream (Status .CANCELLED );
312
312
assertTrue (cancelFuture .isSuccess ());
313
313
assertTrue (createFuture .isDone ());
314
- assertTrue (createFuture .isSuccess ());
314
+ assertFalse (createFuture .isSuccess ());
315
315
}
316
316
317
317
/**
You can’t perform that action at this time.
0 commit comments