Reduce a bind failure to trace logging (#46891)
Due to recent changes in the nio transport, a failure to bind the server channel has started to be logged at an error level. This exception leads to an automatic retry on a different port, so it should only be logged at a trace level.
This commit is contained in:
parent
22dade8e1b
commit
f02582de4b
|
@ -22,6 +22,7 @@ package org.elasticsearch.nio;
|
||||||
import org.elasticsearch.common.concurrent.CompletableContext;
|
import org.elasticsearch.common.concurrent.CompletableContext;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.net.BindException;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.net.ServerSocket;
|
import java.net.ServerSocket;
|
||||||
import java.nio.channels.ServerSocketChannel;
|
import java.nio.channels.ServerSocketChannel;
|
||||||
|
@ -78,7 +79,8 @@ public class ServerChannelContext extends ChannelContext<ServerSocketChannel> {
|
||||||
rawChannel.bind(localAddress);
|
rawChannel.bind(localAddress);
|
||||||
bindContext.complete(null);
|
bindContext.complete(null);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
IOException exception = new IOException("Failed to bind server socket channel {localAddress=" + localAddress + "}.", e);
|
BindException exception = new BindException("Failed to bind server socket channel {localAddress=" + localAddress + "}.");
|
||||||
|
exception.initCause(e);
|
||||||
bindContext.completeExceptionally(exception);
|
bindContext.completeExceptionally(exception);
|
||||||
throw exception;
|
throw exception;
|
||||||
}
|
}
|
||||||
|
|
|
@ -618,7 +618,11 @@ public abstract class TcpTransport extends AbstractLifecycleComponent implements
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onServerException(TcpServerChannel channel, Exception e) {
|
protected void onServerException(TcpServerChannel channel, Exception e) {
|
||||||
logger.error(new ParameterizedMessage("exception from server channel caught on transport layer [channel={}]", channel), e);
|
if (e instanceof BindException) {
|
||||||
|
logger.trace(() -> new ParameterizedMessage("bind exception from server channel caught on transport layer [{}]", channel), e);
|
||||||
|
} else {
|
||||||
|
logger.error(new ParameterizedMessage("exception from server channel caught on transport layer [{}]", channel), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void serverAcceptedChannel(TcpChannel channel) {
|
protected void serverAcceptedChannel(TcpChannel channel) {
|
||||||
|
|
Loading…
Reference in New Issue