use of software.amazon.awssdk.http.nio.netty.internal.ChannelDiagnostics in project aws-sdk-java-v2 by aws.
the class MultiplexedChannelRecord method acquireClaimedStream.
void acquireClaimedStream(Promise<Channel> promise) {
doInEventLoop(connection.eventLoop(), () -> {
if (state != RecordState.OPEN) {
String message;
// GOAWAY
if (state == RecordState.CLOSED_TO_NEW) {
message = String.format("Connection %s received GOAWAY with Last Stream ID %d. Unable to open new " + "streams on this connection.", connection, lastStreamId);
} else {
message = String.format("Connection %s was closed while acquiring new stream.", connection);
}
log.warn(connection, () -> message);
promise.setFailure(new IOException(message));
return;
}
Future<Http2StreamChannel> streamFuture = new Http2StreamChannelBootstrap(connection).open();
streamFuture.addListener((GenericFutureListener<Future<Http2StreamChannel>>) future -> {
warnIfNotInEventLoop(connection.eventLoop());
if (!future.isSuccess()) {
promise.setFailure(future.cause());
return;
}
Http2StreamChannel channel = future.getNow();
channel.pipeline().addLast(UnusedChannelExceptionHandler.getInstance());
channel.attr(ChannelAttributeKey.HTTP2_FRAME_STREAM).set(channel.stream());
channel.attr(ChannelAttributeKey.CHANNEL_DIAGNOSTICS).set(new ChannelDiagnostics(channel));
childChannels.put(channel.id(), channel);
promise.setSuccess(channel);
if (closeIfIdleTask == null && allowedIdleConnectionTimeMillis != null) {
enableCloseIfIdleTask();
}
});
}, promise);
}
use of software.amazon.awssdk.http.nio.netty.internal.ChannelDiagnostics in project aws-sdk-java-v2 by aws.
the class NettyUtils method closedChannelMessage.
public static String closedChannelMessage(Channel channel) {
ChannelDiagnostics channelDiagnostics = channel.attr(CHANNEL_DIAGNOSTICS).get();
ChannelDiagnostics parentChannelDiagnostics = channel.parent() != null ? channel.parent().attr(CHANNEL_DIAGNOSTICS).get() : null;
StringBuilder error = new StringBuilder();
error.append("The connection was closed during the request. The request will usually succeed on a retry, but if it does" + " not: consider disabling any proxies you have configured, enabling debug logging, or performing a TCP" + " dump to identify the root cause. If this is a streaming operation, validate that data is being read or" + " written in a timely manner.");
if (channelDiagnostics != null) {
error.append(" Channel Information: ").append(channelDiagnostics);
if (parentChannelDiagnostics != null) {
error.append(" Parent Channel Information: ").append(parentChannelDiagnostics);
}
}
return error.toString();
}
Aggregations