Skip to content

Ignore failures to set socket options on Mac #44355

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

Merged
merged 4 commits into from
Jul 17, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion libs/nio/src/main/java/org/elasticsearch/nio/ChannelFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,19 @@ ServerSocketChannel openNioServerSocketChannel(InetSocketAddress address) throws
return serverSocketChannel;
}

private static final boolean MAC_OS_X = System.getProperty("os.name").startsWith("Mac OS X");

private void configureSocketChannel(SocketChannel channel) throws IOException {
channel.configureBlocking(false);
java.net.Socket socket = channel.socket();
socket.setTcpNoDelay(tcpNoDelay);
try {
socket.setTcpNoDelay(tcpNoDelay);
} catch (java.net.SocketException e) {
if (MAC_OS_X == false) {
// ignore on Mac, see https://github.com/elastic/elasticsearch/issues/41071
throw e;
}
}
socket.setKeepAlive(tcpKeepAlive);
socket.setReuseAddress(tcpReusedAddress);
if (tcpSendBufferSize > 0) {
Expand Down