Skip to content

Commit aee83f4

Browse files
dagnirzoewangg
authored andcommitted
Additional logging for GOAWAY
Should help during debugging and troubleshooting.
1 parent 22c4f08 commit aee83f4

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

http-clients/netty-nio-client/src/main/java/software/amazon/awssdk/http/nio/netty/internal/http2/Http2MultiplexedChannelPool.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ private Future<Void> closeAndReleaseParent(Channel parentChannel, Throwable caus
316316
}
317317

318318
public void handleGoAway(Channel parentChannel, int lastStreamId, GoAwayException exception) {
319-
log.debug(() -> "Received GOAWAY on " + parentChannel + " with lastStreamId of " + lastStreamId);
319+
log.warn(() -> "Received GOAWAY on " + parentChannel + " with lastStreamId of " + lastStreamId);
320320
try {
321321
MultiplexedChannelRecord multiplexedChannel = parentChannel.attr(MULTIPLEXED_CHANNEL).get();
322322

http-clients/netty-nio-client/src/main/java/software/amazon/awssdk/http/nio/netty/internal/http2/MultiplexedChannelRecord.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public class MultiplexedChannelRecord {
6161
// Only write in the connection.eventLoop()
6262
private volatile RecordState state = RecordState.OPEN;
6363

64+
private volatile int lastStreamId;
6465

6566
MultiplexedChannelRecord(Channel connection, long maxConcurrencyPerConnection, Duration allowedIdleConnectionTime) {
6667
this.connection = connection;
@@ -81,7 +82,15 @@ boolean acquireStream(Promise<Channel> promise) {
8182
private void acquireClaimedStream(Promise<Channel> promise) {
8283
doInEventLoop(connection.eventLoop(), () -> {
8384
if (state != RecordState.OPEN) {
84-
String message = "Connection received GOAWAY or was closed while acquiring new stream.";
85+
String message;
86+
// GOAWAY
87+
if (state == RecordState.CLOSED_TO_NEW) {
88+
message = String.format("Connection %s received GOAWAY with Last Stream ID %d. Unable to open new "
89+
+ "streams on this connection.", connection, lastStreamId);
90+
} else {
91+
message = String.format("Connection %s was closed while acquiring new stream.", connection);
92+
}
93+
log.warn(() -> message);
8594
promise.setFailure(new IllegalStateException(message));
8695
return;
8796
}
@@ -145,6 +154,8 @@ private void releaseClaim() {
145154
*/
146155
void handleGoAway(int lastStreamId, GoAwayException exception) {
147156
doInEventLoop(connection.eventLoop(), () -> {
157+
this.lastStreamId = lastStreamId;
158+
148159
if (state == RecordState.CLOSED) {
149160
return;
150161
}

0 commit comments

Comments
 (0)